From 6140d30f3039c9e9313d74a854c1a691117c3a9d Mon Sep 17 00:00:00 2001 From: sheldon66 Date: Sat, 8 Mar 2025 00:45:39 +0800 Subject: [PATCH] fix(auth): improve 401 error handling by checking for 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 46da074a18..6f78a89d7c 100644 --- a/packages/plugins/@nocobase/plugin-auth/src/client/interceptors.ts +++ b/packages/plugins/@nocobase/plugin-auth/src/client/interceptors.ts @@ -74,7 +74,7 @@ export function authCheckMiddleware({ app }: { app: Application }) { } } - if (error.status === 401 && !error.config?.skipAuth) { + if (error.status === 401 && !error.config?.skipAuth && firstError?.code && AuthErrorCode[firstError.code]) { if (!firstError || firstError?.code === AuthErrorCode.SKIP_TOKEN_RENEW) { throw error; }