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', name: 'Auth',
data () { data () {
return { return {
tab: 'register' tab: 'login'
} }
}, },
components: { components: {

View File

@ -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')
} }
}) })
} }