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 removeTodo = (todo: TodoImmutable) => {
  2.  
  3.     return (dispatch: Function) => {
  4.         return getDB().then((db: PouchDB.Database) =>
  5.             db.get(todo.get('_id')).then((doc) => {
  6.                 return db.remove(doc).then(response => {
  7.  
  8.                     // On notifie le store Redux
  9.                     dispatch({
  10.                         type: Action.REMOVE_TODO,
  11.                         todo
  12.                     });
  13.                 });
  14.  
  15.             })
  16.         );
  17.     };
  18. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement