diff --git a/src/components/Search/SearchRestaurantItem.tsx b/src/components/Search/SearchRestaurantItem.tsx index f550bee..c8e7f29 100644 --- a/src/components/Search/SearchRestaurantItem.tsx +++ b/src/components/Search/SearchRestaurantItem.tsx @@ -18,6 +18,7 @@ import React from 'react'; import { useRecoilValue, useSetRecoilState } from 'recoil'; import { foodPartyCreateDrawerOpenState } from 'stores/drawer'; import { searchRestaurantListState, selectedRestaurantState } from 'stores/restaurant'; +import { DEFAULT_IMAGE } from 'utils/constants/foodParty'; import ROUTING_PATHS from 'utils/constants/routingPaths'; import { getCategoryArray } from 'utils/helpers/foodParty'; @@ -94,6 +95,8 @@ const SearchRestaurantItem = ({ borderRadius={8} objectFit='cover' src={photoUrl} + fallbackStrategy={'onError' || 'beforeLoadOrError'} + fallbackSrc={DEFAULT_IMAGE} alt='food' /> ))} diff --git a/src/hooks/useSearchRestaurant.ts b/src/hooks/useSearchRestaurant.ts index a7768af..4575514 100644 --- a/src/hooks/useSearchRestaurant.ts +++ b/src/hooks/useSearchRestaurant.ts @@ -3,11 +3,10 @@ import { foodPartyCreateDrawerOpenState } from 'stores/drawer'; import { kakaoMapOptionsState } from 'stores/kakaoMap'; import { searchRestaurantListState } from 'stores/restaurant'; import { AxiosPhotoResponseValue } from 'types/kakaoSearch'; +import { DEFAULT_IMAGE } from 'utils/constants/foodParty'; import { keywordSearch } from 'utils/helpers/kakaoMap'; import { getKeywordPhotos } from 'utils/helpers/kakaoSearch'; -const DEFAULT_IMAGE = '/images/default-restaurant.svg'; - const useSearchRestaurant = () => { const kakaoMapOptions = useRecoilValue(kakaoMapOptionsState); const setRestaurantList = useSetRecoilState(searchRestaurantListState); diff --git a/src/utils/constants/foodParty.ts b/src/utils/constants/foodParty.ts index e3ff018..193aef5 100644 --- a/src/utils/constants/foodParty.ts +++ b/src/utils/constants/foodParty.ts @@ -1,3 +1,5 @@ +export const DEFAULT_IMAGE = '/images/default-restaurant.svg'; + export const foodPartyCategory = [ { title: '신나는 술자리',