Skip to content

Commit

Permalink
Put new task at the beginning after create action
Browse files Browse the repository at this point in the history
  • Loading branch information
kirchik95 committed Nov 25, 2024
1 parent 2953f74 commit 36ed111
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pages/Tasks/store/slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const tasksSlice = createSlice({
state.status = 'failed';
})
.addCase(createTask.fulfilled, (state, action: PayloadAction<TaskEntity>) => {
state.tasks.push(action.payload);
state.tasks.unshift(action.payload);
})
.addCase(deleteTask.fulfilled, (state, action: PayloadAction<number>) => {
state.tasks = state.tasks.filter((task) => task.id !== action.payload);
Expand Down

0 comments on commit 36ed111

Please sign in to comment.