Advertisement
cbigot

Untitled

Feb 21st, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. export const changeStatus = (todo: TodoImmutable) => {
  2.  
  3.     todo = todo.set('status', todo.get('status') === CodeStatus.DONE ? CodeStatus.TODO : CodeStatus.DONE);
  4.  
  5.     return (dispatch: Function) => {
  6.         // On appelle la fonction de sauvegarde
  7.         return saveTodo(todo).then(response => {
  8.             // On notifie le store Redux
  9.             dispatch({
  10.                 type: Action.UPDATE_TODO,
  11.                 todo
  12.             });
  13.         });
  14.     };
  15. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement