chore: refactor todolists reducer to use rtk

This commit is contained in:
2024-08-17 18:47:39 +02:00
parent 5067f64ec3
commit 52dbbea2fd
4 changed files with 74 additions and 104 deletions

View File

@@ -1,8 +1,3 @@
import {
AddTodolistActionType,
RemoveTodolistActionType,
SetTodolistsActionType,
} from './todolists-reducer'
import {
TaskPriorities,
TaskStatuses,
@@ -55,9 +50,9 @@ export const tasksReducer = (
return copyState
case 'SET-TODOLISTS': {
const copyState = { ...state }
action.todolists.forEach((tl) => {
copyState[tl.id] = []
})
// action.todolists.forEach((tl) => {
// copyState[tl.id] = []
// })
return copyState
}
case 'SET-TASKS':
@@ -198,7 +193,5 @@ type ActionsType =
| ReturnType<typeof removeTaskAC>
| ReturnType<typeof addTaskAC>
| ReturnType<typeof updateTaskAC>
| AddTodolistActionType
| RemoveTodolistActionType
| SetTodolistsActionType
| ReturnType<typeof setTasksAC>
| any