Add newTaskcardPrompt to create new task

This commit is contained in:
2020-03-30 17:21:51 +05:30
parent 1770328ad8
commit 04ad79d89f
3 changed files with 42 additions and 2 deletions
+11 -1
View File
@@ -48,10 +48,20 @@ export const slice = createSlice({
name,
cards: []
});
},
createTask: (state, action) => {
const { text: cardText, listID: parentListID } = action.payload;
const parentList = state.lists.find(({ id }) => id === parentListID);
parentList.cards.push({
id: `Card #${generateID()}`,
text: cardText
});
}
}
});
export const { createList } = slice.actions;
export const { createList, createTask } = slice.actions;
export default slice.reducer;