Skip to content

Commit

Permalink
fix(middleware): redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Nov 12, 2017
1 parent 7b0f14c commit 77bd1e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/templates/auth.middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import middleware from './middleware'
middleware.auth = function authMiddleware ({ store, redirect }) {
// If user not logged in, redirect to /login
if (!store.getters['auth/loggedIn']) {
return redirect('<%= options.redirect.loggedIn %>')
return redirect('<%= options.redirect.notLoggedIn %>')
}
}

middleware['no-auth'] = function noAuthMiddleware ({ store, redirect }) {
// If user is already logged in, redirect to /
if (store.getters['auth/loggedIn']) {
return redirect('<%= options.redirect.notLoggedIn %>')
return redirect('<%= options.redirect.loggedIn %>')
}
}

0 comments on commit 77bd1e4

Please sign in to comment.