From ad8066b76e8ee362cd12ef83d457ffc5a087859c Mon Sep 17 00:00:00 2001 From: "Fredrick W. Warren" Date: Mon, 15 Feb 2021 07:29:28 -0800 Subject: [PATCH] 20.05 Read Data - When Task Updated --- src/store/store-tasks.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/store/store-tasks.js b/src/store/store-tasks.js index f4e46c7..101fcbd 100644 --- a/src/store/store-tasks.js +++ b/src/store/store-tasks.js @@ -81,6 +81,16 @@ const actions = { } commit('addTask', payload) }) + + // child changed + userTasks.on('child_changed', snapshot => { + const task = snapshot.val() + const payload = { + id: snapshot.key, + updates: task + } + commit('updateTask', payload) + }) } }