luisruiz

Untitled

Jun 21st, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. exports.deleteUser = functions.https.onCall((data, context) => {
  2.  
  3. var users = data.users;
  4.  
  5. var promises = [];
  6.  
  7. users.forEach(function(user) {
  8. return admin.auth().deleteUser(user).then(() => {
  9. return promise.push(admin.firestore().collection('users').doc(user))
  10. })
  11. console.log(user)
  12. });
  13.  
  14.  
  15. return Promise.all(promises).then(() => {
  16.  
  17. return {
  18. messagge: 'Usuarios eliminados con exito!'
  19. }
  20.  
  21. }).catch(error => {
  22. return {
  23. message: 'error:' + error
  24. }
  25.  
  26. });
  27. })
Advertisement
Add Comment
Please, Sign In to add comment