Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export const addTodo = (todoContent: string) => {
- const newTodo: Todo = {
- _id: 'todo_' + new Date().getTime(),
- content: todoContent,
- status: CodeStatus.TODO
- };
- return (dispatch: Function) => {
- // On appelle notre fonction de sauvegarde
- return saveTodo(fromJS(newTodo)).then(reponse => {
- // On notifie notre store avec une action d'ajout
- dispatch({
- type: Action.ADD_TODO,
- todo: fromJS(newTodo)
- });
- });
- };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement