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) {
|
2019-11-17 09:25:14 +00:00
|
|
|
const endpoint = arn.findAPIEndpoint(button)
|
2017-10-17 09:27:15 +00:00
|
|
|
|
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) {
|
2019-11-17 09:25:14 +00:00
|
|
|
const endpoint = arn.findAPIEndpoint(button)
|
2017-10-17 09:27:15 +00:00
|
|
|
|
2019-04-22 06:02:51 +00:00
|
|
|
try {
|
|
|
|
await arn.post(endpoint + "/unpublish")
|
|
|
|
await arn.reloadContent()
|
|
|
|
} catch(err) {
|
|
|
|
arn.statusMessage.showError(err)
|
|
|
|
}
|
2019-11-17 09:44:30 +00:00
|
|
|
}
|