-
Notifications
You must be signed in to change notification settings - Fork 0
Delete Organization
Danny Hinshaw edited this page Dec 20, 2018
·
2 revisions
To delete an organization you can use the /deleteOrganization
https endpoint.
NOTE: This cannot be undone
// Authenticate as admin
const authRef = firebase.auth();
const userCred: UserCredential = await authRef.signInWithEmailAndPassword("[email protected]", "your-password");
const tokenID: string = await userCred.user.getIdToken();
// Example request data
const requestObj = {
method: 'post',
body: JSON.stringify({ id: "SOME_ORG_ID" }),
headers: {
'Authorization': `Bearer ${tokenID}`,
'Content-Type': 'application/json'
}
};
// URL For triggering http cloud functions
const apiBaseURL = "https://us-central1-mrg-production-8813d.cloudfunctions.net";
// Call the https endpoint
fetch(apiBaseURL.concat('/deleteOrganization'), requestObj)
.then((response) => console.log(response))
.catch((err: FirebaseError) => console.log(err));
// response ex. { id: "SOME_ORG_ID" }