feat: re-added automatic revoke
This commit is contained in:
parent
6aa725fb77
commit
a4b98ba58a
1 changed files with 2 additions and 1 deletions
|
@ -2,6 +2,7 @@ import type { NitroFetchRequest, NitroFetchOptions } from "nitropack";
|
|||
|
||||
export default async <T>(request: NitroFetchRequest, options: NitroFetchOptions<string> = {}) => {
|
||||
const accessToken = useCookie("access_token").value;
|
||||
const { revoke } = useAuth();
|
||||
console.log("access token 2:", accessToken);
|
||||
|
||||
let headers: HeadersInit = {};
|
||||
|
@ -27,7 +28,7 @@ export default async <T>(request: NitroFetchRequest, options: NitroFetchOptions<
|
|||
return res;
|
||||
} catch (error: any) {
|
||||
if (error?.response?.status === 401) {
|
||||
// auth.revoke();
|
||||
revoke();
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue