donal
2018-04-16 78a403c450425ea86fad7df5737a4a53ed4c6714
commit | author | age
82de6c 1 export default {
D 2   SET_LOADING(state, bool) {
12f5dd 3     console.log("INFO - Setting loading wheel");
82de6c 4     state.loading = bool;
D 5   },
6   SET_TODOS(state, todos) {
12f5dd 7     console.log("INFO - Setting todos");
82de6c 8     state.todos = todos;
D 9   },
10   SET_NEW_TODO(state, todo) {
12f5dd 11     console.log("INFO - Setting new todo");
82de6c 12     state.newTodo = todo;
D 13   },
14   ADD_TODO(state, todo) {
12f5dd 15     console.log("INFO - Add todo", todo);
82de6c 16     state.todos.push(todo);
D 17   },
18   CLEAR_NEW_TODO(state) {
12f5dd 19     console.log("INFO - Clearing new todo");
D 20     state.newTodo = "";
fbee7b 21   },
08cb74 22   CLEAR_ALL_DONE_TODOS(state) {
12f5dd 23     console.log("INFO - Clearing all done todos");
e38844 24     state.todos = state.todos.filter(obj => obj.completed === false);
08cb74 25   },
fbee7b 26   CLEAR_ALL_TODOS(state) {
12f5dd 27     console.log("INFO - Clearing all todos");
e38844 28     state.todos = [];
08cb74 29   },
ba91cd 30   MARK_TODO_COMPLETED(state, index) {
12f5dd 31     console.log("INFO - MARK_TODO_COMPLETED");
ba91cd 32     state.todos[index].completed = !state.todos[index].completed;
82de6c 33   }
D 34 };