Skip to content

Commit

Permalink
[#188] Fix: 뒤로가기 제어 (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
Heeeera authored Mar 21, 2024
1 parent a01b432 commit 8867af2
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/UserProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const UserProfile = ({
queryClient.invalidateQueries({
queryKey: [GATHERING_DETAIL_QUERY_KEY, gatheringId],
});
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`);
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`, { replace: true });
};

const handleKickParticipant = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/CreateBoardGameTip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const CreateBoardGameTipPage = () => {

const handleCloseModal = () => {
setIsModalOpen(false);
navigate(`${BOARD_GAMES_PAGE_URL}/${boardGameId}`);
navigate(`${BOARD_GAMES_PAGE_URL}/${boardGameId}`, { replace: true });
};

const handleOpenModal = () => {
Expand Down
4 changes: 3 additions & 1 deletion src/pages/GatheringCreate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ const GatheringCreatePage = () => {

const handleCloseModal = () => {
setIsModalOpen(false);
navigate(`${GATHERINGS_PAGE_URL}/${createdGatheringId}/0`);
navigate(`${GATHERINGS_PAGE_URL}/${createdGatheringId}/0`, {
replace: true,
});
};

const handleCreateGathering = (gatheringId: number) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const DeleteGatheringButton = ({ gatheringId }: GatheringIdProps) => {

const handleCloseIsSuccessModal = () => {
setIsSuccessModalOpen(false);
navigate('/');
navigate('/', { replace: true });
};

const handleOpenIsSuccessModal = () => {
Expand Down
4 changes: 3 additions & 1 deletion src/pages/GatheringDetail/components/TabMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const TabMenu = ({ tabs }: TabMenuProps) => {
'text-gray-accent4': tabIndex !== String(index),
})}
onClick={() =>
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/${index}`)
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/${index}`, {
replace: true,
})
}
>
{tab}
Expand Down
6 changes: 5 additions & 1 deletion src/pages/GatheringDetail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@ const GatheringDetailPage = () => {
? participantResponse.some(({ userId }) => userId === data.id)
: false;

const goToGatheringListPage = () => {
navigate('/');
};

return (
<div className='flex h-full flex-col'>
<TabBar.Container>
<TabBar.Left>
<TabBar.GoBackButton />
<TabBar.GoBackButton onClick={goToGatheringListPage} />
</TabBar.Left>
<TabBar.Right>
{isParticipation && (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/GatheringFix/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const GatheringFixPage = () => {

const handleCloseModal = () => {
setIsModalOpen(false);
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`);
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`, { replace: true });
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/GatheringUnfix/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const GatheringUnfixPage = () => {

const handleCloseModal = () => {
setIsModalOpen(false);
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`);
navigate(`${GATHERINGS_PAGE_URL}/${gatheringId}/0`, { replace: true });
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Profile/hooks/useLogout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const useLogout = () => {
logoutApi: async () => {
await api();
localStorage.removeItem(STORAGE_KEY_ACCESS_TOKEN);
navigate('/');
navigate('/', { replace: true });
},
};
};
2 changes: 1 addition & 1 deletion src/pages/ProfileEdit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ProfileEdit = () => {

const handleCloseModal = () => {
setIsModalOpen(false);
navigate(`/users/${userId}`);
navigate(`/users/${userId}`, { replace: true });
};

const handleProfileEdit = (userId: number) => {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Register/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const RegisterPage = () => {
useEffect(() => {
if (isJoined) {
showErrorToast(IS_SIGN_UP_USER_MESSAGE);
navigate('/');
navigate('/', { replace: true });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand All @@ -30,7 +30,7 @@ const RegisterPage = () => {

const handleCloseModal = () => {
setIsModalOpen(false);
navigate('/');
navigate('/', { replace: true });
};

return (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ReviewCreate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const ReviewCreate = () => {

const handleCloseModal = () => {
setIsModalOpen(false);
navigate(ROOMS_MY_END_GAMES_API_URL);
navigate(ROOMS_MY_END_GAMES_API_URL, { replace: true });
};

const handleReviewCreate = () => {
Expand Down

0 comments on commit 8867af2

Please sign in to comment.