remove unused api interceptor
This commit is contained in:
@@ -32,7 +32,6 @@ const queryClient = new QueryClient();
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export const ApiProvider: React.FC<ApiProviderProps> = ({ children }) => {
|
export const ApiProvider: React.FC<ApiProviderProps> = ({ children }) => {
|
||||||
const navigate = useNavigate();
|
|
||||||
const axiosInstance = axios.create({
|
const axiosInstance = axios.create({
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
});
|
});
|
||||||
@@ -41,21 +40,6 @@ export const ApiProvider: React.FC<ApiProviderProps> = ({ children }) => {
|
|||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
internalAxiosInstance.interceptors.response.use(
|
|
||||||
(response) => response,
|
|
||||||
(error) => {
|
|
||||||
// only handle 403 errors
|
|
||||||
if (!error.response) return Promise.reject(error);
|
|
||||||
|
|
||||||
if (error.response.status === 401) {
|
|
||||||
// redirect to login page
|
|
||||||
return navigate('/login', {});
|
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.reject(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const apiClient = createApi(axiosInstance);
|
const apiClient = createApi(axiosInstance);
|
||||||
const tanstackApiClient = createTanstackApi(internalAxiosInstance);
|
const tanstackApiClient = createTanstackApi(internalAxiosInstance);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user