Skip to content

Commit

Permalink
Fix Middlware on Page Refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
tcampbPPU committed Aug 14, 2023
1 parent 088c327 commit 6ff52a1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/middleware/auth.global.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
export default defineNuxtRouteMiddleware((to, from) => {
if (import.meta.server)
return

const api = useApi()
if (api && to.path !== api.config.redirect.logout && to.path !== '/invalid' && api.loggedIn.value === false) {

if (api && to.path !== api.config.redirect.logout && to.path !== '/invalid' && !api.loggedIn.value) {
if (to.meta.middleware === 'guest')
return
if (from.meta.middleware === 'guest')
Expand Down

0 comments on commit 6ff52a1

Please sign in to comment.