Skip to content

Commit

Permalink
Merge pull request #168 from depromeet/fix/#166
Browse files Browse the repository at this point in the history
리뷰 남기기 분기처리
  • Loading branch information
sjoleee authored Jan 29, 2024
2 parents 818111b + ed08d66 commit 824ba39
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/components/main/WriteLogButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ export default function WriteLogButton({
storeId: storeId ?? undefined,
});

useEffect(() => {
if (!isSuccess) return;

if (!data.isAvailable) {
toast('같은 곳은 하루에 3번만 기록 가능해요!');
return;
}

const goToReview = () => {
const url = new URL(`${window.location.origin}/review`);

if (!storeId && searchedPinFromSearchParams) {
Expand Down Expand Up @@ -84,9 +77,24 @@ export default function WriteLogButton({
url.searchParams.set('myRevisitedCount', String(myRevisitedCount));

router.push(String(url));
};

useEffect(() => {
if (!isSuccess) return;

if (!data.isAvailable) {
toast('같은 곳은 하루에 3번만 기록 가능해요!');
return;
}

goToReview();
}, [isSuccess]);

const handleWriteLogButtonClick = () => {
if (!storeId) {
goToReview();
return;
}
getReviewAvailable();
};

Expand Down

0 comments on commit 824ba39

Please sign in to comment.