fix: refresh loop once access token expires caused by attempt to revoke auth
This commit is contained in:
parent
d9aef4eb3a
commit
6752b44e95
1 changed files with 2 additions and 3 deletions
|
@ -18,7 +18,7 @@ export default async <T>(path: string, options: NitroFetchOptions<string> = {})
|
|||
return;
|
||||
}
|
||||
console.log("path:", path)
|
||||
const { revoke, refresh } = useAuth();
|
||||
const { clearAuth, refresh } = useAuth();
|
||||
|
||||
let headers: HeadersInit = {};
|
||||
|
||||
|
@ -61,8 +61,7 @@ export default async <T>(path: string, options: NitroFetchOptions<string> = {})
|
|||
if (error?.response?.status === 401) {
|
||||
console.log("Refresh returned 401");
|
||||
reauthFailed = true;
|
||||
console.log("Revoking");
|
||||
await revoke();
|
||||
await clearAuth()
|
||||
console.log("Redirecting to login");
|
||||
await navigateTo("/login");
|
||||
console.log("redirected");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue