Created
June 23, 2017 22:37
-
-
Save kaueDM/03fcccfb20338f788d3a02bd1eddd855 to your computer and use it in GitHub Desktop.
Estrutura atual das minhas promises
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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