18.08 Redirect on Log In Log Out

This commit is contained in:
Fredrick W. Warren 2021-02-13 19:52:46 -08:00
parent 27563c4d21
commit 60f0dcf11a
2 changed files with 4 additions and 2 deletions

View File

@ -41,7 +41,7 @@ export default {
name: 'Auth',
data () {
return {
tab: 'register'
tab: 'login'
}
},
components: {

View File

@ -33,11 +33,13 @@ const actions = {
firebaseAuth.signOut()
},
handleAuthStateChange ({ commit }) {
firebaseAuth.onAuthStateChanged(function (user) {
firebaseAuth.onAuthStateChanged(user => {
if (user) {
commit('setLoggedIn', true)
this.$router.push('/')
} else {
commit('setLoggedIn', false)
this.$router.replace('/auth')
}
})
}