diff --git a/src/api/axiosInstance.ts b/src/api/axiosInstance.ts index d53b3b7..37848e6 100644 --- a/src/api/axiosInstance.ts +++ b/src/api/axiosInstance.ts @@ -1,6 +1,7 @@ import axios from 'axios'; import { HTTP_STATUS } from '@/constants/common/httpStatus'; +import { PATH } from '@/constants/common/path'; export const axiosInstance = axios.create({ baseURL: process.env.NEXT_PUBLIC_API_URL, @@ -26,6 +27,8 @@ axiosInstance.interceptors.response.use( const { response, config } = error; if (response?.status === HTTP_STATUS.UNAUTHORIZED) { + localStorage.removeItem('accessToken'); + window.location.href = PATH.INTRO; } if (response) { @@ -36,6 +39,7 @@ axiosInstance.interceptors.response.use( } else { console.error('🚨[API NETWORK ERROR], error.message'); } + return Promise.reject(error); }, ); diff --git a/src/components/layout/Header/HomeHeader.tsx b/src/components/layout/Header/HomeHeader.tsx index e5082a0..b33b09d 100644 --- a/src/components/layout/Header/HomeHeader.tsx +++ b/src/components/layout/Header/HomeHeader.tsx @@ -26,7 +26,7 @@ const HomeHeader = ({ hasMenu = false, bgColor }: HomeHeaderProps) => { const hasToken = useHasToken(); - const handleClose = () => { + const handleLogoClick = () => { if (hasToken) router.push(PATH.INTRO); router.push(PATH.HOME); }; @@ -35,7 +35,7 @@ const HomeHeader = ({ hasMenu = false, bgColor }: HomeHeaderProps) => { <> +