18.11 Navigation Guards - Create a Boot File
This commit is contained in:
parent
5819aa7724
commit
f1fcfac4c5
@ -20,6 +20,7 @@ module.exports = function (/* ctx */) {
|
|||||||
// https://quasar.dev/quasar-cli/boot-files
|
// https://quasar.dev/quasar-cli/boot-files
|
||||||
boot: [
|
boot: [
|
||||||
'firebase',
|
'firebase',
|
||||||
|
'rooter-auth',
|
||||||
'axios'
|
'axios'
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
|
import { LocalStorage } from 'quasar'
|
||||||
|
|
||||||
export default async ({ router }) => {
|
export default async ({ router }) => {
|
||||||
router.beforeEach((to, from, next) => {
|
router.beforeEach((to, from, next) => {
|
||||||
console.log('to: ', to)
|
const loggedIn = LocalStorage.getItem('loggedIn')
|
||||||
console.log('from: ', from)
|
if (!loggedIn && to.path !== '/auth') {
|
||||||
console.log('next: ', next)
|
next('/auth')
|
||||||
next()
|
} else {
|
||||||
|
next()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user