jeudi 30 août 2018

Passing data to server from web javascript and perform delete operation

I am new to http triggers. I am developing an admin website using firestore. Now what I want is, if the admin wants to delete a user from firebase authentication by using below code.

admin.auth().deleteUser(uid)
  .then(function() {
    console.log("Successfully deleted user");
  })
  .catch(function(error) {
    console.log("Error deleting user:", error);
  });

For that we need admin. we can get the admin by below line. We have to write those above codes in Node.js(functions).

const admin = require('firebase-admin');

Now my html page design is, I have a button in html page. When I press that button I can get the related user uid. Now my problem is how to send that uid to server(node.js) and perform delete action. I have no idea on this.




Aucun commentaire:

Enregistrer un commentaire