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 () {
firebaseAuth.signOut()
},
handleAuthStateChange ({ commit }) {
handleAuthStateChange ({ commit, dispatch }) {
firebaseAuth.onAuthStateChanged(user => {
Loading.hide()
if (user) {
commit('setLoggedIn', true)
/* eslint handle-callback-err: "off" */
this.$router.push('/').catch(err => {})
dispatch('tasks/fbReadData', null, { root: true })
} else {
commit('setLoggedIn', false)
this.$router.replace('/auth').catch(err => { })

View File

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