diff --git a/src/service/axiosInstance.ts b/src/service/axiosInstance.ts index ba69e542..c5b155d9 100644 --- a/src/service/axiosInstance.ts +++ b/src/service/axiosInstance.ts @@ -1,6 +1,7 @@ import axios, { AxiosError, AxiosResponse, InternalAxiosRequestConfig } from 'axios'; import { CustomInstance } from '../types'; import qs from 'qs'; +import { useNavigate } from 'react-router-dom'; const axiosConfig = { baseURL: import.meta.env.VITE_BASE_URL, @@ -31,6 +32,9 @@ const onError = (error: AxiosError) => { if (response?.data) { console.error(response.data); + if (response?.status === 400 || response?.status === 403) { + window.location.href = '/signin'; + } } return Promise.reject(error); diff --git a/src/service/recruit/applicant.ts b/src/service/recruit/applicant.ts index 40ab2b43..c644e96a 100644 --- a/src/service/recruit/applicant.ts +++ b/src/service/recruit/applicant.ts @@ -1,3 +1,4 @@ +import { useNavigate } from 'react-router-dom'; import { ApplicantList, ApplicantPageInfo,