Skip to content

Commit

Permalink
check auth before redirect in middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
btkostner committed Aug 1, 2020
1 parent e8e15a7 commit 8a1ad76
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions middleware/auth.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
export default function ({ redirect, store }) {
if (!store.getters['auth/loggedIn']) {
store.commit('auth/check')
}

if (!store.getters['auth/loggedIn']) {
return redirect('/auth/login')
}
Expand Down

0 comments on commit 8a1ad76

Please sign in to comment.