20.02 Read Data when user Logs In

This commit is contained in:
Fredrick W. Warren 2021-02-15 05:55:58 -08:00
parent f84098008b
commit e2dec4f1c6
2 changed files with 5 additions and 1 deletions

View File

@ -37,13 +37,14 @@ const actions = {
logoutUser () { logoutUser () {
firebaseAuth.signOut() firebaseAuth.signOut()
}, },
handleAuthStateChange ({ commit }) { handleAuthStateChange ({ commit, dispatch }) {
firebaseAuth.onAuthStateChanged(user => { firebaseAuth.onAuthStateChanged(user => {
Loading.hide() Loading.hide()
if (user) { if (user) {
commit('setLoggedIn', true) commit('setLoggedIn', true)
/* eslint handle-callback-err: "off" */ /* eslint handle-callback-err: "off" */
this.$router.push('/').catch(err => {}) this.$router.push('/').catch(err => {})
dispatch('tasks/fbReadData', null, { root: true })
} else { } else {
commit('setLoggedIn', false) commit('setLoggedIn', false)
this.$router.replace('/auth').catch(err => { }) this.$router.replace('/auth').catch(err => { })

View File

@ -66,6 +66,9 @@ const actions = {
}, },
setSort ({ commit }, value) { setSort ({ commit }, value) {
commit('setSort', value) commit('setSort', value)
},
fbReadData ({ commit }) {
console.log('read data from database')
} }
} }