Added episode sync for editors

This commit is contained in:
2020-11-07 07:45:38 +09:00
parent 8bd56db757
commit 81f18ec233
5 changed files with 60 additions and 0 deletions

View File

@ -105,3 +105,21 @@ export async function startJob(arn: AnimeNotifier, button: HTMLButtonElement) {
await arn.post(`/api/job/${jobName}/start`)
arn.reloadContent()
}
// Sync episodes
export async function syncEpisodes(arn: AnimeNotifier, button: HTMLButtonElement) {
if(!confirm("Are you sure you want to start the episode sync?")) {
return
}
const animeId = button.dataset.animeId
arn.statusMessage.showInfo("Started episode sync.", -1)
try {
await arn.post(`/api/anime/${animeId}/sync-episodes`)
arn.statusMessage.showInfo("Finished episode sync.")
} catch(err) {
arn.statusMessage.showError(err)
}
}