chore(deps): upgrade Next.js to 15.1.9
- Upgrade next package from 15.1.6 to 15.1.9 - Upgrade eslint-config-next from 15.1.6 to 15.1.9 - Sort axios imports alphabetically in response-interceptor - Skip token refresh for login endpoint to prevent infinite redirect loops - Add check to prevent automatic token refresh when login request fails
This commit is contained in:
+2
-2
@@ -23,7 +23,7 @@
|
|||||||
"js-cookie": "^3.0.5",
|
"js-cookie": "^3.0.5",
|
||||||
"jsvectormap": "^1.6.0",
|
"jsvectormap": "^1.6.0",
|
||||||
"moment": "^2.30.1",
|
"moment": "^2.30.1",
|
||||||
"next": "15.1.6",
|
"next": "15.1.9",
|
||||||
"next-themes": "^0.4.4",
|
"next-themes": "^0.4.4",
|
||||||
"nextjs-toploader": "^3.7.15",
|
"nextjs-toploader": "^3.7.15",
|
||||||
"react": "19.0.0",
|
"react": "19.0.0",
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
"@types/react-dom": "19.0.3",
|
"@types/react-dom": "19.0.3",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
"eslint": "^9",
|
"eslint": "^9",
|
||||||
"eslint-config-next": "15.1.6",
|
"eslint-config-next": "15.1.9",
|
||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
"prettier": "^3.4.2",
|
"prettier": "^3.4.2",
|
||||||
"prettier-plugin-tailwindcss": "^0.6.11",
|
"prettier-plugin-tailwindcss": "^0.6.11",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { AxiosResponse, AxiosError } from "axios";
|
import { AxiosError, AxiosResponse } from "axios";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { API_ENDPOINTS, api } from "../lib/api";
|
import { API_ENDPOINTS, api } from "../lib/api";
|
||||||
@@ -26,7 +26,16 @@ export const responseInterceptor = (response: AxiosResponse) => {
|
|||||||
export const responseErrorHandler = async (error: AxiosError) => {
|
export const responseErrorHandler = async (error: AxiosError) => {
|
||||||
const originalRequest = error.config as any;
|
const originalRequest = error.config as any;
|
||||||
|
|
||||||
if (error.response?.status === 401 && !originalRequest._retry) {
|
// Skip token refresh for login endpoint - let login errors pass through
|
||||||
|
const isLoginRequest = originalRequest?.url?.includes(
|
||||||
|
API_ENDPOINTS.USER.LOGIN,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
error.response?.status === 401 &&
|
||||||
|
!originalRequest._retry &&
|
||||||
|
!isLoginRequest
|
||||||
|
) {
|
||||||
if (isRefreshing) {
|
if (isRefreshing) {
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
failedQueue.push({ resolve, reject });
|
failedQueue.push({ resolve, reject });
|
||||||
|
|||||||
Reference in New Issue
Block a user