fix(auth): improve 401 error handling by checking for specific error codes

This commit is contained in:
sheldon66 2025-03-08 00:45:39 +08:00
parent 69575af6a9
commit 6140d30f30

View File

@ -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;
}