Implemented soundtrack deletion

This commit is contained in:
2017-10-17 11:43:07 +02:00
parent d65f3fd7bb
commit 96c0d22192
3 changed files with 30 additions and 3 deletions

17
scripts/Actions/Delete.ts Normal file
View File

@ -0,0 +1,17 @@
import { AnimeNotifier } from "../AnimeNotifier"
// Delete
export function deleteObject(arn: AnimeNotifier, button: HTMLButtonElement) {
let confirmType = button.dataset.confirmType
let returnPath = button.dataset.returnPath
if(!confirm(`Are you sure you want to delete this ${confirmType}?`)) {
return
}
let endpoint = arn.findAPIEndpoint(button)
arn.post(endpoint + "/delete", "")
.then(() => arn.app.load(returnPath))
.catch(err => arn.statusMessage.showError(err))
}