refresh token

This commit is contained in:
hamid zarghami
2025-03-06 12:54:24 +03:30
parent cfb6c330cf
commit 64be114e26
5 changed files with 76 additions and 12 deletions
+5 -5
View File
@@ -1,5 +1,5 @@
import axios from "axios";
import { Pages } from "./Pages";
// import { Pages } from "./Pages";
const axiosInstance = axios.create({
baseURL: import.meta.env.VITE_BASE_URL,
@@ -8,10 +8,10 @@ const axiosInstance = axios.create({
axiosInstance.interceptors.response.use(
(response) => response,
(error) => {
if (error.response.status === 401) {
localStorage.removeItem(import.meta.env.VITE_TOKEN_NAME);
window.location.href = Pages.auth.login;
}
// if (error.response.status === 401) {
// localStorage.removeItem(import.meta.env.VITE_TOKEN_NAME);
// window.location.href = Pages.auth.login;
// }
return Promise.reject(error);
}
);