21.03 Write Data - When Task Updated
This commit is contained in:
parent
d09fc4e6ba
commit
f46d10d26f
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user