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:
committed by
Yoshua Wuyts
parent
a5e13790c4
commit
5602bc039b
+12
-2
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user