todo-list.reducers.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const todoListReducers = ( | |
lastState: TodoListState = new TodoListInitState(), | |
action: GenericAction<TodoListActionTypes, any> | |
): TodoListState => { | |
switch (action.type) { | |
case TodoListActionTypes.LoadTodoList: | |
return loadTodoItems(lastState, action); | |
case TodoListActionTypes.TodoItemsLoaded: | |
return todoItemsLoaded(lastState, action); | |
case TodoListActionTypes.TodoItemsLoadFailed: | |
return todoItemsLoadFailed(lastState, action); | |
case TodoListActionTypes.TodoItemCreated: | |
return todoItemCreatedReducer(lastState, action); | |
case TodoListActionTypes.TodoItemsLoadFailed: | |
return todoItemsLoadFailed(lastState, action); | |
case TodoListActionTypes.TodoItemDeleted: | |
return todoItemDeletedReducer(lastState, action); | |
case TodoListActionTypes.TodoItemUpdated: | |
return todoItemUpdatedReducer(lastState, action); | |
case TodoListActionTypes.TodoItemCompleted: | |
return todoItemCompletedReducer(lastState, action); | |
default: | |
return lastState; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment