From b91840c819241c32a87c95bc3ccaf873eb9ed1b5 Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Fri, 7 Nov 2025 09:54:10 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9(frontend)=20set=20correctly=20quer?= =?UTF-8?q?y=20data=20when=20401?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When receiving a 401 error, we should set the auth query data to null, not to an object with user: null and authenticated: false. This ensures that components relying on the auth state can correctly interpret the unauthenticated status. --- .../apps/impress/src/features/auth/api/useAuthQuery.tsx | 2 +- src/frontend/apps/impress/src/pages/docs/[id]/index.tsx | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/frontend/apps/impress/src/features/auth/api/useAuthQuery.tsx b/src/frontend/apps/impress/src/features/auth/api/useAuthQuery.tsx index 0b3fe070..592ce4c7 100644 --- a/src/frontend/apps/impress/src/features/auth/api/useAuthQuery.tsx +++ b/src/frontend/apps/impress/src/features/auth/api/useAuthQuery.tsx @@ -44,7 +44,7 @@ export function useAuthQuery( staleTime: 1000 * 60 * 15, // 15 minutes retry: (failureCount, error) => { // we assume that a 401 means the user is not logged in - if (error.status == 401) { + if (error.status === 401) { return false; } return failureCount < DEFAULT_QUERY_RETRY; diff --git a/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx b/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx index 7b465913..81c3d18c 100644 --- a/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx +++ b/src/frontend/apps/impress/src/pages/docs/[id]/index.tsx @@ -176,10 +176,7 @@ const DocPage = ({ id }: DocProps) => { if (error.status === 401) { if (authenticated) { - queryClient.setQueryData([KEY_AUTH], { - user: null, - authenticated: false, - }); + queryClient.setQueryData([KEY_AUTH], null); } setAuthUrl(); }