21.04 Write Data - When Task Deleted
This commit is contained in:
parent
65b76d2255
commit
f6de60571b
@ -51,8 +51,8 @@ const actions = {
|
|||||||
updateTask ({ dispatch }, payload) {
|
updateTask ({ dispatch }, payload) {
|
||||||
dispatch('fbUpdateTask', payload)
|
dispatch('fbUpdateTask', payload)
|
||||||
},
|
},
|
||||||
deleteTask ({ commit }, id) {
|
deleteTask ({ dispatch }, id) {
|
||||||
commit('deleteTask', id)
|
dispatch('fbDeleteTask', id)
|
||||||
},
|
},
|
||||||
addTask ({ dispatch }, task) {
|
addTask ({ dispatch }, task) {
|
||||||
const taskId = uid()
|
const taskId = uid()
|
||||||
@ -107,6 +107,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.update(payload.updates)
|
taskRef.update(payload.updates)
|
||||||
|
},
|
||||||
|
fbDeleteTask ({ commit }, taskId) {
|
||||||
|
const userId = firebaseAuth.currentUser.uid
|
||||||
|
const taskRef = firebaseDb.ref('tasks/' + userId + '/' + taskId)
|
||||||
|
taskRef.remove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user