Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit f66eaa6

Browse files
committed
fix: Move expired call to getNewToken instead of onError.
1 parent b215619 commit f66eaa6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

apps/client/src/stores/auth/actions/fetchAuthenticated.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ const initialiseFetchWrapper = () =>
1010
client: getClient(),
1111

1212
getNewToken: () => {
13+
// Set the status to expired
14+
useAuthStore.setState({ status: AuthStatus.EXPIRED });
15+
1316
return null; // Fail this step, we don't want to log out until the user does so explicitly
1417
},
1518

@@ -22,12 +25,6 @@ const initialiseFetchWrapper = () =>
2225
getStoredToken: () => {
2326
return useAuthStore.getState().token;
2427
},
25-
26-
onError: (error) => {
27-
// Set the status to expired
28-
useAuthStore.setState({ status: AuthStatus.EXPIRED });
29-
console.error(error);
30-
},
3128
});
3229

3330
let _fetchWrapper: OAuth2Fetch | null = null;

0 commit comments

Comments
 (0)