diff --git a/src/app/page.tsx b/src/app/page.tsx index 40385777..48f7f73a 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -194,7 +194,7 @@ export default function Home() { /> -
+
{ + if (!storeId) { + goToReview(); + return; + } + + try { + await getReviewAvailable(); + + setIsFetched(true); + } catch (error) { + toast('에러 발생! 다시 시도해주세요.'); + } + }; + useEffect(() => { - if (isRefetching || !isSuccess) return; + if (!isFetched) return; + setIsFetched(false); - if (!data.isAvailable) { + if (data?.isAvailable === false) { toast('같은 곳은 하루에 3번만 기록 가능해요!'); return; } goToReview(); - }, [isRefetching, isSuccess]); - - const handleWriteLogButtonClick = () => { - if (!storeId) { - goToReview(); - return; - } - getReviewAvailable(); - }; + }, [isFetched]); return (