Fixes for example code (#433)

* Added bel,  choo-persist, and choo-log to dependencies

* Fixed bug in example code where deletes were not updating active/done lists correctly
This commit is contained in:
Byron Hulcher
2017-03-22 00:49:21 +01:00
committed by Yoshua Wuyts
parent a5e13790c4
commit 5602bc039b
2 changed files with 15 additions and 2 deletions
+12 -2
View File
@@ -131,11 +131,21 @@ function todoStore (state, emitter) {
if (todo.done) {
var done = state.todos.done
var doneIndex = done[todo]
var doneIndex
done.forEach(function (_todo, j) {
if (_todo.id === id) {
doneIndex = j
}
})
done.splice(doneIndex, 1)
} else {
var active = state.todos.active
var activeIndex = active[todo]
var activeIndex
active.forEach(function (_todo, j) {
if (_todo.id === id) {
activeIndex = j
}
})
active.splice(activeIndex, 1)
}
emitter.emit('render')