From 936f1ae318b4ef0edce4d93a679a24e05253bb3a Mon Sep 17 00:00:00 2001 From: sdwoo Date: Wed, 3 May 2023 17:50:53 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20Default=20Image=20constant=20?= =?UTF-8?q?=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useSearchRestaurant.ts | 3 +-- src/utils/constants/foodParty.ts | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) 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: '신나는 술자리', From 11f7cb94e3c19f3ecd8684485102898bfeb0ed41 Mon Sep 17 00:00:00 2001 From: sdwoo Date: Wed, 3 May 2023 17:51:53 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor:=20defaultImage=20onError=EC=99=80?= =?UTF-8?q?=20beforeLoadOrError=EC=8B=9C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Search/SearchRestaurantItem.tsx | 3 +++ 1 file changed, 3 insertions(+) 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' /> ))}