-
-
Save lydemann/08cfe7210bbcf3cb2042d09440d4af68 to your computer and use it in GitHub Desktop.
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
import { Injectable } from '@angular/core'; | |
import { TODOItem } from '@app/shared/models/todo-item'; | |
import { GenericAction } from '@app/store/generic-action'; | |
import { dispatch } from '@angular-redux/store'; | |
export enum TodoListActionTypes { | |
TodoItemsLoaded = 'TodoItemsLoaded', | |
TodoItemCreated = 'TodoItemCreated', | |
TodoItemDeleted = 'TodoItemDeleted', | |
TodoItemUpdated = 'TodoItemUpdated', | |
TodoItemCompleted = 'TodoItemCompleted', | |
} | |
@Injectable() | |
export class TodoListActions { | |
constructor() { | |
} | |
@dispatch() | |
public todoItemsLoaded(payload: TODOItem[]): GenericAction<TodoListActionTypes, TODOItem[]> { | |
return { | |
type: TodoListActionTypes.TodoItemsLoaded, | |
payload: payload | |
}; | |
} | |
@dispatch() | |
public todoItemCreated(todoItem: TODOItem): GenericAction<TodoListActionTypes, TODOItem> { | |
return { | |
type: TodoListActionTypes.TodoItemCreated, | |
payload: todoItem | |
}; | |
} | |
@dispatch() | |
public todoItemDeleted(todoItem: TODOItem): GenericAction<TodoListActionTypes, TODOItem> { | |
return { | |
type: TodoListActionTypes.TodoItemDeleted, | |
payload: todoItem | |
}; | |
} | |
@dispatch() | |
public todoItemUpdated(todoItem: TODOItem): GenericAction<TodoListActionTypes, TODOItem> { | |
return { | |
type: TodoListActionTypes.TodoItemUpdated, | |
payload: todoItem | |
}; | |
} | |
@dispatch() | |
public todoItemCompleted(todoItem: TODOItem): GenericAction<TodoListActionTypes, TODOItem> { | |
return { | |
type: TodoListActionTypes.TodoItemCompleted, | |
payload: todoItem | |
}; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment