diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx index 209b5cd..9329dbb 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutList.tsx @@ -8,7 +8,7 @@ export const SelloutList = ({ listings }) => {
- {listings.map((listing) => ( + {listings?.map(listing => ( ))} diff --git a/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx b/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx index db7f0b4..0188c16 100644 --- a/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx +++ b/phone/src/apps/sellout/components/SelloutList/SelloutListContainer.tsx @@ -20,12 +20,12 @@ const useStyles = makeStyles((theme: Theme) => ({ export const SelloutListContainer = () => { const { modal } = useListingModal(); const { itemModal } = useItemModal(); - const listing = useListing(); + const { listings } = useListing(); const classes = useStyles(); return (
- {itemModal ? : } + {itemModal ? : }
); }; diff --git a/phone/src/apps/sellout/hooks/state.ts b/phone/src/apps/sellout/hooks/state.ts index fb1cb8d..f7412d7 100644 --- a/phone/src/apps/sellout/hooks/state.ts +++ b/phone/src/apps/sellout/hooks/state.ts @@ -3,7 +3,7 @@ import { atom } from 'recoil'; export const selloutState = { listing: atom({ key: 'listing', - default: [], + default: null, }), listingModal: atom({ key: 'listingModal', diff --git a/phone/src/apps/sellout/hooks/useListing.ts b/phone/src/apps/sellout/hooks/useListing.ts index 0e93885..e606ef8 100644 --- a/phone/src/apps/sellout/hooks/useListing.ts +++ b/phone/src/apps/sellout/hooks/useListing.ts @@ -1,9 +1,13 @@ import { useRecoilValue } from 'recoil'; import { selloutState } from './state'; -import { Listings } from '../../../common/typings/listings'; +import { ListingProps } from '../../../common/typings/listings'; -export const useListing = () => { +interface ListingHook { + listings: ListingProps[]; +} + +export const useListing = (): ListingHook => { const listings = useRecoilValue(selloutState.listing); - return listings; + return { listings }; }; diff --git a/phone/src/common/typings/listings.ts b/phone/src/common/typings/listings.ts index 0722bb2..e7e3acc 100644 --- a/phone/src/common/typings/listings.ts +++ b/phone/src/common/typings/listings.ts @@ -1,4 +1,5 @@ -export interface Listings { +export interface ListingProps { + id: number; name: string; phone_number: string; title: string;