Skip to content

Commit

Permalink
fix: prevent infinite redirect for guests
Browse files Browse the repository at this point in the history
  • Loading branch information
manchenkoff committed Apr 4, 2024
1 parent 8338dd8 commit 20e7cc9
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/runtime/httpFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,6 @@ export function createHttpClient(): $Fetch {
async onResponseError({ response }): Promise<void> {
if (response.status === 401) {
user.value = null;

const currentRoute = nuxtApp.$router.currentRoute.value;

if (
options.redirect.onLogout === false ||
options.redirect.onLogout === currentRoute.path ||
options.redirect.onAuthOnly === currentRoute.path ||
options.globalMiddleware.enabled === true
) {
return;
}

await nuxtApp.runWithContext(() =>
navigateTo(options.redirect.onLogout as string)
);
}
},
};
Expand Down

0 comments on commit 20e7cc9

Please sign in to comment.