mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
refactor(resources/photo): refactor photos
This commit is contained in:
1 parent
3470700fc1
commit
10e28b911e
5 files changed
+106
-63
No files matched your search
@@ -0,0 +1,25 @@
|
||||
import { getSource } from '../utils/miscUtils';
|
||||
import { GalleryPhoto, PhotoEvents } from '../../../typings/photo';
|
||||
import PhotoService from './photo.service';
|
||||
import { photoLogger } from './photo.utils';
|
||||
|
||||
onNet(PhotoEvents.UPLOAD_PHOTO, async (image: string) => {
|
||||
const src = getSource();
|
||||
PhotoService.handleUploadPhoto(src, image).catch((e) =>
|
||||
photoLogger.error(`Error occurred in upload photo event (${src}), Error: ${e.message}`),
|
||||
);
|
||||
});
|
||||
|
||||
onNet(PhotoEvents.FETCH_PHOTOS, async () => {
|
||||
const src = getSource();
|
||||
PhotoService.handleFetchPhotos(src).catch((e) =>
|
||||
photoLogger.error(`Error occurred in upload photo event (${src}), Error: ${e.message}`),
|
||||
);
|
||||
});
|
||||
|
||||
onNet(PhotoEvents.DELETE_PHOTO, async (photo: GalleryPhoto) => {
|
||||
const src = getSource();
|
||||
PhotoService.handleDeletePhoto(src, photo).catch((e) =>
|
||||
photoLogger.error(`Error occurred in delete photo event (${src}), Error: ${e.message}`),
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user