25 lines
619 B
TypeScript
Raw Normal View History

2018-04-02 05:34:16 +00:00
import AnimeNotifier from "../AnimeNotifier"
2017-10-17 09:27:15 +00:00
// Publish
2019-04-22 06:02:51 +00:00
export async function publish(arn: AnimeNotifier, button: HTMLButtonElement) {
2017-10-17 09:27:15 +00:00
let endpoint = arn.findAPIEndpoint(button)
2019-04-22 06:02:51 +00:00
try {
await arn.post(endpoint + "/publish")
await arn.app.load(arn.app.currentPath.replace("/edit", ""))
} catch(err) {
arn.statusMessage.showError(err)
}
2017-10-17 09:27:15 +00:00
}
// Unpublish
2019-04-22 06:02:51 +00:00
export async function unpublish(arn: AnimeNotifier, button: HTMLButtonElement) {
2017-10-17 09:27:15 +00:00
let endpoint = arn.findAPIEndpoint(button)
2019-04-22 06:02:51 +00:00
try {
await arn.post(endpoint + "/unpublish")
await arn.reloadContent()
} catch(err) {
arn.statusMessage.showError(err)
}
2017-10-17 09:27:15 +00:00
}