mirror of
https://github.com/bendtherules/demo-trello-app.git
synced 2026-08-18 13:42:40 +00:00
Add newTaskcardPrompt to create new task
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user