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