From 8b746c81856861703ea78dadab34e0f1991b3825 Mon Sep 17 00:00:00 2001 From: Taso Date: Thu, 1 Apr 2021 13:35:43 -0400 Subject: [PATCH] cleanup(phone/photos): Added type safety to photo state --- phone/src/apps/camera/hooks/state.ts | 5 +++-- phone/src/apps/camera/hooks/usePhotos.ts | 9 ++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/phone/src/apps/camera/hooks/state.ts b/phone/src/apps/camera/hooks/state.ts index aa6495e..b5f9177 100644 --- a/phone/src/apps/camera/hooks/state.ts +++ b/phone/src/apps/camera/hooks/state.ts @@ -1,8 +1,9 @@ import { atom } from 'recoil'; +import { IPhoto } from '../../../../../typings/photo'; export const photoState = { - photos: atom({ + photos: atom({ key: 'galleryPhotos', - default: null, + default: [], }), }; diff --git a/phone/src/apps/camera/hooks/usePhotos.ts b/phone/src/apps/camera/hooks/usePhotos.ts index 1bee938..073a653 100644 --- a/phone/src/apps/camera/hooks/usePhotos.ts +++ b/phone/src/apps/camera/hooks/usePhotos.ts @@ -1,11 +1,6 @@ import { useRecoilValue } from 'recoil'; import { photoState } from './state'; -export interface ICameraPhoto { - id: string; - image: string; -} - -export const usePhotos = (): ICameraPhoto[] | null => { - return useRecoilValue(photoState.photos); +export const usePhotos = () => { + return useRecoilValue(photoState.photos); };