18.11 Navigation Guards - Create a Boot File
This commit is contained in:
1 parent
5819aa7724
commit
f1fcfac4c5
2 files changed
+9
-4
No files matched your search
@@ -1,8 +1,12 @@
|
||||
import { LocalStorage } from 'quasar'
|
||||
|
||||
export default async ({ router }) => {
|
||||
router.beforeEach((to, from, next) => {
|
||||
console.log('to: ', to)
|
||||
console.log('from: ', from)
|
||||
console.log('next: ', next)
|
||||
next()
|
||||
const loggedIn = LocalStorage.getItem('loggedIn')
|
||||
if (!loggedIn && to.path !== '/auth') {
|
||||
next('/auth')
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user