21.03 Write Data - When Task Updated

This commit is contained in:
Fredrick W. Warren 2021-02-15 08:43:37 -08:00
parent d09fc4e6ba
commit f46d10d26f

View File

@ -48,8 +48,8 @@ const mutations = {
} }
const actions = { const actions = {
updateTask ({ commit }, payload) { updateTask ({ dispatch }, payload) {
commit('updateTask', payload) dispatch('fbUpdateTask', payload)
}, },
deleteTask ({ commit }, id) { deleteTask ({ commit }, id) {
commit('deleteTask', id) commit('deleteTask', id)
@ -102,6 +102,11 @@ const actions = {
const userId = firebaseAuth.currentUser.uid const userId = firebaseAuth.currentUser.uid
const taskRef = firebaseDb.ref('tasks/' + userId + '/' + payload.id) const taskRef = firebaseDb.ref('tasks/' + userId + '/' + payload.id)
taskRef.set(payload.task) taskRef.set(payload.task)
},
fbUpdateTask ({ commit }, payload) {
const userId = firebaseAuth.currentUser.uid
const taskRef = firebaseDb.ref('tasks/' + userId + '/' + payload.id)
taskRef.update(payload.updates)
} }
} }