Added feature for delete user account

This commit is contained in:
Damien Broqua 2024-06-19 11:22:21 +02:00
parent 6ee117b583
commit ad8b8f4767
4 changed files with 78 additions and 1 deletions

View file

@ -22,8 +22,10 @@ if (typeof email !== "undefined" && typeof username !== "undefined") {
wantlist:
"Je viens d'ajouter {artist} - {album} à ma liste de souhaits !",
},
delete: false,
},
loading: false,
deleting: false,
errors: [],
};
},
@ -108,6 +110,20 @@ if (typeof email !== "undefined" && typeof username !== "undefined") {
return true;
},
async deleteAccount() {
try {
await axios.delete(`/api/v1/me`);
showToastr("Compte supprimé", true);
window.location.href = "/se-deconnecter";
} catch (err) {
showToastr(
err.response?.data?.message ||
"Impossible de mettre à jour votre profil"
);
}
},
},
}).mount("#mon-compte");
}