Skip to content

Instantly share code, notes, and snippets.

@zacck-zz
Created September 7, 2016 09:40
Show Gist options
  • Save zacck-zz/a02c081c549c1c9a8f3592cc900e4d64 to your computer and use it in GitHub Desktop.
Save zacck-zz/a02c081c549c1c9a8f3592cc900e4d64 to your computer and use it in GitHub Desktop.
export var startToggleTodo = (id, completed) => {
return (dispatch, getState) => {
/*access item we need to change*/
var todoRef = firebaseRef.child(`todos/${id}`);
/*generate Updates*/
var updates = {
completed,
completedAt: completed ? moment.unix() : null
};
/*start updating*/
todoRef.update(updates).then(() => {
dispatch(updateTodo(id, updates));
});
};
};
firebase.js?678b:426 Uncaught Error: Firebase.update failed: First argument contains NaN in property 'todos.-KQ_BiN5I0nel2NrBnxl.completedAt._i'22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment