Skip to content

Commit

Permalink
Merge pull request #115 from fumeapp/fix/middleware
Browse files Browse the repository at this point in the history
Fix Middleware on Page Refresh
  • Loading branch information
acidjazz committed Aug 15, 2023
2 parents 088c327 + 6ff52a1 commit 985eb01
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 985eb01

Please sign in to comment.