From 6752b44e954ba99d8ec7e9833cf69376dbb187ab Mon Sep 17 00:00:00 2001 From: SauceyRed Date: Sat, 12 Jul 2025 17:48:49 +0200 Subject: [PATCH] fix: refresh loop once access token expires caused by attempt to revoke auth --- utils/fetchWithApi.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/utils/fetchWithApi.ts b/utils/fetchWithApi.ts index 4089db8..664412c 100644 --- a/utils/fetchWithApi.ts +++ b/utils/fetchWithApi.ts @@ -18,7 +18,7 @@ export default async (path: string, options: NitroFetchOptions = {}) return; } console.log("path:", path) - const { revoke, refresh } = useAuth(); + const { clearAuth, refresh } = useAuth(); let headers: HeadersInit = {}; @@ -61,8 +61,7 @@ export default async (path: string, options: NitroFetchOptions = {}) 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");