From 69575af6a961e43f74881e98db94e40ad55ceabe Mon Sep 17 00:00:00 2001 From: sheldon66 Date: Sat, 8 Mar 2025 00:38:37 +0800 Subject: [PATCH] fix(auth): enhance error handling for 401 status with specific error codes --- .../plugins/@nocobase/plugin-auth/src/client/interceptors.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/@nocobase/plugin-auth/src/client/interceptors.ts b/packages/plugins/@nocobase/plugin-auth/src/client/interceptors.ts index cdde3bafa7..46da074a18 100644 --- a/packages/plugins/@nocobase/plugin-auth/src/client/interceptors.ts +++ b/packages/plugins/@nocobase/plugin-auth/src/client/interceptors.ts @@ -61,7 +61,7 @@ export function authCheckMiddleware({ app }: { app: Application }) { app.apiClient.auth.setToken(newToken); } - if (error.status === 401) { + if (error.status === 401 && firstError?.code && AuthErrorCode[firstError.code]) { app.apiClient.auth.setToken(''); if (pathname === app.getHref('signin') && firstError?.code !== AuthErrorCode.EMPTY_TOKEN && error.config) { error.config.skipNotify = false;