Skip to content

Commit 95b87b0

Browse files
authored
Merge pull request #190 from CodeitFESI4-Team1/Hotfix/Reload
Hotfix/reload
2 parents dd9e349 + 8ac43b5 commit 95b87b0

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

src/app/(crew)/crew/detail/[id]/_components/gathering-list-section.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export default function GatheringListSection({ id }: GatheringListSectionProps)
2222
const handleLike = async (gatheringId: number) => {
2323
try {
2424
await addLike(gatheringId);
25-
toast.success('찜하기가 완료되었습니다!');
2625
} catch (apiError) {
2726
if (apiError instanceof ApiError && apiError.status === 401) {
2827
toast.error('로그인이 필요합니다.');
@@ -35,7 +34,6 @@ export default function GatheringListSection({ id }: GatheringListSectionProps)
3534
const handleUnlike = async (gatheringId: number) => {
3635
try {
3736
await removeLike(gatheringId);
38-
toast.success('찜하기 해제가 완료되었습니다!');
3937
} catch (apiError) {
4038
if (apiError instanceof ApiError && apiError.status === 401) {
4139
toast.error('로그인이 필요합니다.');

src/app/(crew)/my-page/_components/reviewable-gatherings/reviewable-gathering-card-list.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import MyReviewSkeletonList from '@/src/components/common/skeleton/my-review-ske
66
import ReviewableGatheringCard from './reviewable-gathering-card';
77

88
export default function ReviewableGatheringCardList() {
9-
const { data, ref, isFetchingNextPage, isLoading } = useInfiniteScroll(
9+
const { data, ref, isFetchingNextPage, isLoading, refetch } = useInfiniteScroll(
1010
useGetReviewableQuery({
1111
pageable: { page: 0, size: 6, sort: ['dateTime,desc'] },
1212
}),
@@ -50,6 +50,7 @@ export default function ReviewableGatheringCardList() {
5050
totalCount={item.totalCount}
5151
imageUrl={item.imageUrl}
5252
participants={item.participants}
53+
refetchList={refetch}
5354
/>
5455
))}
5556
</li>

src/app/(crew)/my-page/_components/reviewable-gatherings/reviewable-gathering-card.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface ReviewableGatheringCardProps {
1818
totalCount: number;
1919
imageUrl: string;
2020
participants: ParticipantType[];
21+
refetchList: () => void;
2122
}
2223

2324
export default function ReviewableGatheringCard({
@@ -29,6 +30,7 @@ export default function ReviewableGatheringCard({
2930
imageUrl,
3031
participants,
3132
totalCount,
33+
refetchList,
3234
}: ReviewableGatheringCardProps) {
3335
const [isModalOpened, setIsModalOpened] = useState(false);
3436
const formatDate = formatCompactDateTime24H(dateTime);
@@ -94,6 +96,10 @@ export default function ReviewableGatheringCard({
9496
close={() => {
9597
setIsModalOpened(false);
9698
}}
99+
onReviewSuccess={() => {
100+
setIsModalOpened(false);
101+
refetchList();
102+
}}
97103
/>
98104
</div>
99105
);

src/app/(crew)/my-page/_components/reviewing-modal/review-form.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ type FormValues = {
1515
interface ReviewFormProps {
1616
gatheringId?: number;
1717
onCancel: () => void;
18+
onReviewSuccess: () => void;
1819
}
1920

20-
export default function ReviewForm({ gatheringId, onCancel }: ReviewFormProps) {
21+
export default function ReviewForm({ gatheringId, onCancel, onReviewSuccess }: ReviewFormProps) {
2122
const { register, handleSubmit, control } = useForm<FormValues>();
2223
const [textReview, setTextReview] = useState<string>('');
2324

@@ -45,6 +46,7 @@ export default function ReviewForm({ gatheringId, onCancel }: ReviewFormProps) {
4546

4647
onSuccess: () => {
4748
onCancel();
49+
onReviewSuccess();
4850
},
4951
onError: (error: ApiError) => {
5052
// eslint-disable-next-line no-console

src/app/(crew)/my-page/_components/reviewing-modal/reviewing-modal.stories.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,15 @@ const Template: StoryFn<ReviewingModalProps> = function GatheringDetailModalStor
3030
setIsOpened(opened);
3131
}, [opened]);
3232

33+
const onReviewSuccess = () => {
34+
action('review success')();
35+
setIsOpened(false);
36+
};
37+
3338
return (
3439
<>
3540
<Button onClick={handleOpen}>Open Modal</Button>
36-
<ReviewingModal opened={isOpened} close={handleClose} />
41+
<ReviewingModal opened={isOpened} close={handleClose} onReviewSuccess={onReviewSuccess} />
3742
</>
3843
);
3944
};

src/app/(crew)/my-page/_components/reviewing-modal/reviewing-modal.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,15 @@ export interface ReviewingModalProps {
88
gatheringId?: number;
99
opened: boolean;
1010
close: () => void;
11+
onReviewSuccess: () => void;
1112
}
1213

13-
export default function ReviewingModal({ gatheringId, opened, close }: ReviewingModalProps) {
14+
export default function ReviewingModal({
15+
gatheringId,
16+
opened,
17+
close,
18+
onReviewSuccess,
19+
}: ReviewingModalProps) {
1420
return (
1521
<Modal
1622
opened={opened}
@@ -31,7 +37,7 @@ export default function ReviewingModal({ gatheringId, opened, close }: Reviewing
3137
},
3238
}}
3339
>
34-
<ReviewForm gatheringId={gatheringId} onCancel={close} />
40+
<ReviewForm gatheringId={gatheringId} onCancel={close} onReviewSuccess={onReviewSuccess} />
3541
</Modal>
3642
);
3743
}

0 commit comments

Comments
 (0)