2018-04-02 05:34:16 +00:00
|
|
|
import AnimeNotifier from "../AnimeNotifier"
|
2017-10-17 09:27:15 +00:00
|
|
|
|
|
|
|
// Publish
|
|
|
|
export function publish(arn: AnimeNotifier, button: HTMLButtonElement) {
|
|
|
|
let endpoint = arn.findAPIEndpoint(button)
|
|
|
|
|
2018-04-25 16:59:23 +00:00
|
|
|
arn.post(endpoint + "/publish")
|
2017-10-17 09:27:15 +00:00
|
|
|
.then(() => arn.app.load(arn.app.currentPath.replace("/edit", "")))
|
|
|
|
.catch(err => arn.statusMessage.showError(err))
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unpublish
|
|
|
|
export function unpublish(arn: AnimeNotifier, button: HTMLButtonElement) {
|
|
|
|
let endpoint = arn.findAPIEndpoint(button)
|
|
|
|
|
2018-04-25 16:59:23 +00:00
|
|
|
arn.post(endpoint + "/unpublish")
|
2017-10-17 09:27:15 +00:00
|
|
|
.then(() => arn.reloadContent())
|
|
|
|
.catch(err => arn.statusMessage.showError(err))
|
|
|
|
}
|