Moving to a todo app
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import Store from '.';
|
||||
|
||||
export const setDone = (list, item, done) => {
|
||||
Store.update((s, o) => {
|
||||
const listIndex = o.lists.findIndex(l => l === list);
|
||||
const itemIndex = o.lists[listIndex].items.findIndex(i => i === item);
|
||||
s.lists[listIndex].items[itemIndex].done = done;
|
||||
if (list === o.selectedList) {
|
||||
s.selectedList = s.lists[listIndex];
|
||||
}
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user