part way done with next item
This commit is contained in:
parent
492ecb3e3e
commit
5819aa7724
8
src/boot/rooter-auth.js
Normal file
8
src/boot/rooter-auth.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export default async ({ router }) => {
|
||||||
|
router.beforeEach((to, from, next) => {
|
||||||
|
console.log('to: ', to)
|
||||||
|
console.log('from: ', from)
|
||||||
|
console.log('next: ', next)
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
}
|
@ -38,10 +38,11 @@ const actions = {
|
|||||||
firebaseAuth.onAuthStateChanged(user => {
|
firebaseAuth.onAuthStateChanged(user => {
|
||||||
if (user) {
|
if (user) {
|
||||||
commit('setLoggedIn', true)
|
commit('setLoggedIn', true)
|
||||||
this.$router.push('/')
|
/* eslint handle-callback-err: "off" */
|
||||||
|
this.$router.push('/').catch(err => {})
|
||||||
} else {
|
} else {
|
||||||
commit('setLoggedIn', false)
|
commit('setLoggedIn', false)
|
||||||
this.$router.replace('/auth')
|
this.$router.replace('/auth').catch(err => { })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user