Skip to content

Commit

Permalink
feat(demos): add/update client
Browse files Browse the repository at this point in the history
  • Loading branch information
julio-saito-linx committed Nov 15, 2016
1 parent 9552c22 commit 9b88427
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/demo/src/modules/clients/actions/saveDraft.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
function saveDraft ({state, path}) {
function saveDraft ({state, path, firebase}) {
const draft = state.get('clients.$draft')
const uid = state.get('user.currentUser.uid')

state.set(`clients.all.${draft.ref}`, draft)

return path.success()
firebase.update(`clients.${uid}.${draft.ref}`, draft)
.then(() => {
state.set(`clients.all.${draft.ref}`, draft)
})
.then(path.success)
.catch(path.error)
}

export default saveDraft

0 comments on commit 9b88427

Please sign in to comment.