diff --git a/src/store/store-auth.js b/src/store/store-auth.js index 8d39215..a2dd773 100644 --- a/src/store/store-auth.js +++ b/src/store/store-auth.js @@ -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 => { }) diff --git a/src/store/store-tasks.js b/src/store/store-tasks.js index 24fb1c2..350e321 100644 --- a/src/store/store-tasks.js +++ b/src/store/store-tasks.js @@ -66,6 +66,9 @@ const actions = { }, setSort ({ commit }, value) { commit('setSort', value) + }, + fbReadData ({ commit }) { + console.log('read data from database') } }