Started working on Kitsu import

This commit is contained in:
2018-03-18 21:41:13 +01:00
parent 180c5b475b
commit 771e6b026c
4 changed files with 43 additions and 1 deletions

View File

@ -26,4 +26,18 @@ export function malDiffFilterAnime(arn: AnimeNotifier, input: HTMLInputElement)
let type = arn.app.find("filter-type") as HTMLSelectElement
arn.app.load(`/editor/anime/maldiff/${year.value}/${status.value}/${type.value}`)
}
// Import Kitsu anime
export async function importKitsuAnime(arn: AnimeNotifier, button: HTMLButtonElement) {
let response = await fetch(`/api/import/kitsu/anime/${button.dataset.id}`, {
method: "POST",
credentials: "same-origin"
})
if(response.ok) {
arn.reloadContent()
} else {
arn.statusMessage.showError(await response.text())
}
}