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:
AmirReza Jamali
2025-12-08 16:35:42 +03:30
parent 918c562cfc
commit 13d736e9f0
2 changed files with 13 additions and 4 deletions
+11 -2
View File
@@ -1,4 +1,4 @@
import { AxiosResponse, AxiosError } from "axios";
import { AxiosError, AxiosResponse } from "axios";
import Cookies from "js-cookie";
import { toast } from "react-toastify";
import { API_ENDPOINTS, api } from "../lib/api";
@@ -26,7 +26,16 @@ export const responseInterceptor = (response: AxiosResponse) => {
export const responseErrorHandler = async (error: AxiosError) => {
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) {
return new Promise<string>((resolve, reject) => {
failedQueue.push({ resolve, reject });