fucking DELETE method for account is now working and existing
This commit is contained in:
@@ -108,6 +108,23 @@
|
||||
avatar = await fetchAvatar(user.username);
|
||||
}
|
||||
|
||||
const deleteAccount = async() => {
|
||||
console.log("deleting account")
|
||||
await fetch(`http://${process.env.WEBSITE_HOST}:${process.env.WEBSITE_PORT}/api/v2/user`, {
|
||||
method: "DELETE",
|
||||
})
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
throw new Error("HTTP " + response.status);
|
||||
}
|
||||
console.log("account deleted")
|
||||
push('/');
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("catch unable to delete: ", error);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -152,6 +169,7 @@
|
||||
</form>
|
||||
</Card>
|
||||
</div>
|
||||
<Button type="primary" on:click={() => deleteAccount()}>Delete Account</Button>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user