Skip to content

Instantly share code, notes, and snippets.

@kaueDM
Created June 23, 2017 22:37
Show Gist options
  • Save kaueDM/03fcccfb20338f788d3a02bd1eddd855 to your computer and use it in GitHub Desktop.
Save kaueDM/03fcccfb20338f788d3a02bd1eddd855 to your computer and use it in GitHub Desktop.
Estrutura atual das minhas promises
const create = (userUID, customerObj) => {
return new Promise((resolve, reject) => {
const ref = database.ref('user_data').child(userUID).child('customers').push()
const key = ref.key;
ref.set(customerObj)
.then(() => {
resolve(key)
})
.catch(e => {
reject(e)
})
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment