Skip to content

Commit 8867af2

Browse files
authored
[#188] Fix: 뒤로가기 제어 (#189)
1 parent a01b432 commit 8867af2

12 files changed

Lines changed: 21 additions & 13 deletions

File tree

src/components/UserProfile/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const UserProfile = ({
6767
queryClient.invalidateQueries({
6868
queryKey: [GATHERING_DETAIL_QUERY_KEY, gatheringId],
6969
});
70-
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`);
70+
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`, { replace: true });
7171
};
7272

7373
const handleKickParticipant = () => {

src/pages/CreateBoardGameTip/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const CreateBoardGameTipPage = () => {
2020

2121
const handleCloseModal = () => {
2222
setIsModalOpen(false);
23-
navigate(`${BOARD_GAMES_PAGE_URL}/${boardGameId}`);
23+
navigate(`${BOARD_GAMES_PAGE_URL}/${boardGameId}`, { replace: true });
2424
};
2525

2626
const handleOpenModal = () => {

src/pages/GatheringCreate/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ const GatheringCreatePage = () => {
2323

2424
const handleCloseModal = () => {
2525
setIsModalOpen(false);
26-
navigate(`${GATHERINGS_PAGE_URL}/${createdGatheringId}/0`);
26+
navigate(`${GATHERINGS_PAGE_URL}/${createdGatheringId}/0`, {
27+
replace: true,
28+
});
2729
};
2830

2931
const handleCreateGathering = (gatheringId: number) => {

src/pages/GatheringDetail/components/GatheringButton/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ const DeleteGatheringButton = ({ gatheringId }: GatheringIdProps) => {
118118

119119
const handleCloseIsSuccessModal = () => {
120120
setIsSuccessModalOpen(false);
121-
navigate('/');
121+
navigate('/', { replace: true });
122122
};
123123

124124
const handleOpenIsSuccessModal = () => {

src/pages/GatheringDetail/components/TabMenu/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ const TabMenu = ({ tabs }: TabMenuProps) => {
2525
'text-gray-accent4': tabIndex !== String(index),
2626
})}
2727
onClick={() =>
28-
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/${index}`)
28+
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/${index}`, {
29+
replace: true,
30+
})
2931
}
3032
>
3133
{tab}

src/pages/GatheringDetail/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,15 @@ const GatheringDetailPage = () => {
3535
? participantResponse.some(({ userId }) => userId === data.id)
3636
: false;
3737

38+
const goToGatheringListPage = () => {
39+
navigate('/');
40+
};
41+
3842
return (
3943
<div className='flex h-full flex-col'>
4044
<TabBar.Container>
4145
<TabBar.Left>
42-
<TabBar.GoBackButton />
46+
<TabBar.GoBackButton onClick={goToGatheringListPage} />
4347
</TabBar.Left>
4448
<TabBar.Right>
4549
{isParticipation && (

src/pages/GatheringFix/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const GatheringFixPage = () => {
2323

2424
const handleCloseModal = () => {
2525
setIsModalOpen(false);
26-
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`);
26+
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`, { replace: true });
2727
};
2828

2929
return (

src/pages/GatheringUnfix/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const GatheringUnfixPage = () => {
2828

2929
const handleCloseModal = () => {
3030
setIsModalOpen(false);
31-
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`);
31+
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`, { replace: true });
3232
};
3333

3434
return (

src/pages/Profile/hooks/useLogout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const useLogout = () => {
1111
logoutApi: async () => {
1212
await api();
1313
localStorage.removeItem(STORAGE_KEY_ACCESS_TOKEN);
14-
navigate('/');
14+
navigate('/', { replace: true });
1515
},
1616
};
1717
};

src/pages/ProfileEdit/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const ProfileEdit = () => {
2020

2121
const handleCloseModal = () => {
2222
setIsModalOpen(false);
23-
navigate(`/users/${userId}`);
23+
navigate(`/users/${userId}`, { replace: true });
2424
};
2525

2626
const handleProfileEdit = (userId: number) => {

0 commit comments

Comments
 (0)