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 = {
updateTask ({ commit }, payload) {
commit('updateTask', payload)
updateTask ({ dispatch }, payload) {
dispatch('fbUpdateTask', payload)
},
deleteTask ({ commit }, id) {
commit('deleteTask', id)
@ -102,6 +102,11 @@ const actions = {
const userId = firebaseAuth.currentUser.uid
const taskRef = firebaseDb.ref('tasks/' + userId + '/' + payload.id)
taskRef.set(payload.task)
},
fbUpdateTask ({ commit }, payload) {
const userId = firebaseAuth.currentUser.uid
const taskRef = firebaseDb.ref('tasks/' + userId + '/' + payload.id)
taskRef.update(payload.updates)
}
}