add remove page

This commit is contained in:
Diego Najar 2021-06-07 19:50:04 +02:00
parent a27cefec3f
commit 3f39ec94e9

View file

@ -218,6 +218,31 @@ class API {
} }
} }
/* Delete a page
@args array Array => (key: string)
@return string The page key deleted
*/
async deletePage(args) {
var url = this.apiURL + "pages/" + args['key'];
var body = this.body;
try {
var response = await fetch(url, {
credentials: "same-origin",
method: "DELETE",
body: JSON.stringify(body),
headers: new Headers({
"Content-Type": "application/json"
})
});
var json = await response.json();
return json;
} catch (err) {
console.log(err);
return true;
}
}
/* Delete the profile picture from a user /* Delete the profile picture from a user
@args array Array => (username: string) @args array Array => (username: string)