Added anime list deletion
This commit is contained in:
@ -33,7 +33,6 @@ export async function removeAnimeFromCollection(arn: AnimeNotifier, button: HTML
|
||||
}
|
||||
|
||||
button.textContent = "Removing..."
|
||||
|
||||
let {animeId, nick} = button.dataset
|
||||
|
||||
if(!animeId || !nick) {
|
||||
@ -50,4 +49,27 @@ export async function removeAnimeFromCollection(arn: AnimeNotifier, button: HTML
|
||||
} catch(err) {
|
||||
arn.statusMessage.showError(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Delete anime list
|
||||
export async function deleteAnimeList(arn: AnimeNotifier, button: HTMLElement) {
|
||||
if(!confirm("Last confirmation: Are you sure you want to delete your entire anime list?")) {
|
||||
return
|
||||
}
|
||||
|
||||
button.textContent = "Deleting..."
|
||||
let {returnPath} = button.dataset
|
||||
|
||||
if(!returnPath) {
|
||||
console.error("Button without data-return-path:", button)
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await arn.post("/api/delete/animelist")
|
||||
await arn.app.load(returnPath)
|
||||
arn.statusMessage.showInfo("Your anime list has been deleted.")
|
||||
} catch(err) {
|
||||
arn.statusMessage.showError(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user