Deleting categories

This commit is contained in:
2021-08-07 17:11:36 +03:00
parent 0215790d90
commit f271fe30d2
8 changed files with 278 additions and 7 deletions

View File

@@ -18,6 +18,11 @@ export default createStore({
},
removeCategory(state, category) {
state.categories = state.categories.filter((element) => element !== category);
state.tasks = state.tasks.map((task) => {
const newTask = task;
if (newTask.category === category) newTask.category = undefined;
return newTask;
});
},
addTask(state, name) {