Skip to content

Commit

Permalink
fix: accessToken이 조회되지 않는 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
HoberMin committed May 12, 2024
1 parent 608413e commit cdd54d9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/components/AuthorizedRoute/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import { showErrorToast } from '@/utils/showToast';

import SpinnerFullScreen from '../Spinner/SpinnerFullScreen';

const accessToken = localStorage.getItem(STORAGE_KEY_ACCESS_TOKEN);

//FIXME : setTimeout을 사용하지 않으면 toast에 딜레이가 생겨서 임시적으로 setTimeout을 사용하였습니다.
const ErrorToast = (errorMessage: string) =>
setTimeout(() => {
showErrorToast(errorMessage);
}, 0);

const AuthorizedRoute = ({ children }: PropsWithChildren) => {
const accessToken = localStorage.getItem(STORAGE_KEY_ACCESS_TOKEN);
const { data, isLoading } = useGetIsJoinedUserApi(accessToken);

if (accessToken === null) {
Expand Down

0 comments on commit cdd54d9

Please sign in to comment.