//native
type Vercel = {
token: string;
};
/**
* Delete User Account
* Initiates the deletion process for the currently authenticated User, by sending a deletion confirmation email. The email contains a link that the user needs to visit in order to proceed with the deletion process.
*/
export async function main(
auth: Vercel,
body: { reasons?: { slug: string; description: string }[] },
) {
const url = new URL(`https://api.vercel.com/v1/user`);
const response = await fetch(url, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 428 days ago