🩹(frontend) set correctly query data when 401

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.
This commit is contained in:
Anthony LC
2025-11-07 09:54:10 +01:00
parent a9b77fb9a7
commit b91840c819
2 changed files with 2 additions and 5 deletions

View File

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

View File

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