Skip to content

Commit

Permalink
fix: navigate(0)->location.reload() 대체 (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
lydiacho authored Jul 30, 2024
1 parent 63a1ba7 commit 2735f92
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/common/components/Layout/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ const Header = () => {
const menuItems = isMakers ? MENU_ITEMS_MAKERS : MENU_ITEMS;

const handleClickLogo = () => {
pathname === '/' ? navigate(0) : navigate('/');
pathname === '/' ? window.location.reload() : navigate('/');
};

const handleLogout = () => {
track('click-gnb-logout');
reset();
localStorage.removeItem('soptApplyAccessToken');
localStorage.removeItem('soptApplyAccessTokenExpiredTime');
pathname === '/' ? navigate(0) : navigate('/');
pathname === '/' ? window.location.reload() : navigate('/');
};
return (
<>
Expand Down
4 changes: 1 addition & 3 deletions src/views/CompletePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { track } from '@amplitude/analytics-browser';
import { useContext } from 'react';
import { useNavigate } from 'react-router-dom';

import Button from '@components/Button';
import Callout from '@components/Callout';
Expand All @@ -10,15 +9,14 @@ import IconCheckmark from './icons/IconCheckmark';
import { container, icon, mainText, subText } from './style.css';

const CompletePage = () => {
const navigate = useNavigate();
const {
recruitingInfo: { name, season, group, soptName },
} = useContext(RecruitingInfoContext);
const isMakers = soptName?.toLowerCase().includes('makers');

const handleClickMyPage = () => {
track('click-complete-my');
navigate(0);
window.location.reload();
};

return (
Expand Down
5 changes: 1 addition & 4 deletions src/views/SignInPage/hooks/useMutateSignIn.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { setUserId } from '@amplitude/analytics-browser';
import { useMutation } from '@tanstack/react-query';
import { useNavigate } from 'react-router-dom';

import { VALIDATION_CHECK } from '@constants/validationCheck';

Expand All @@ -16,8 +15,6 @@ interface MutateSignInProps {
}

const useMutateSignIn = ({ finalPassConfirmEnd, onSetError }: MutateSignInProps) => {
const navigate = useNavigate();

const { mutate: signInMutate, isPending: signInIsPending } = useMutation<
AxiosResponse<SignInResponse, SignInRequest>,
AxiosError<ErrorResponse, SignInRequest>,
Expand All @@ -28,7 +25,7 @@ const useMutateSignIn = ({ finalPassConfirmEnd, onSetError }: MutateSignInProps)
setUserId(email);
localStorage.setItem('soptApplyAccessToken', token);
localStorage.setItem('soptApplyAccessTokenExpiredTime', finalPassConfirmEnd || '');
navigate(0);
window.location.reload();
},
onError(error) {
if (error.response?.status === 403) {
Expand Down

0 comments on commit 2735f92

Please sign in to comment.