18.08 Redirect on Log In Log Out
This commit is contained in:
parent
27563c4d21
commit
60f0dcf11a
@ -41,7 +41,7 @@ export default {
|
|||||||
name: 'Auth',
|
name: 'Auth',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
tab: 'register'
|
tab: 'login'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
@ -33,11 +33,13 @@ const actions = {
|
|||||||
firebaseAuth.signOut()
|
firebaseAuth.signOut()
|
||||||
},
|
},
|
||||||
handleAuthStateChange ({ commit }) {
|
handleAuthStateChange ({ commit }) {
|
||||||
firebaseAuth.onAuthStateChanged(function (user) {
|
firebaseAuth.onAuthStateChanged(user => {
|
||||||
if (user) {
|
if (user) {
|
||||||
commit('setLoggedIn', true)
|
commit('setLoggedIn', true)
|
||||||
|
this.$router.push('/')
|
||||||
} else {
|
} else {
|
||||||
commit('setLoggedIn', false)
|
commit('setLoggedIn', false)
|
||||||
|
this.$router.replace('/auth')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user