Implemented music page

This commit is contained in:
2017-06-27 16:23:57 +02:00
parent c32166f38c
commit 50cd062140
8 changed files with 45 additions and 159 deletions

View File

@ -103,6 +103,28 @@ export function createThread(arn: AnimeNotifier) {
.catch(console.error)
}
// Create soundtrack
export function createSoundTrack(arn: AnimeNotifier, button: HTMLButtonElement) {
let soundcloud = arn.app.find("soundcloud-link") as HTMLInputElement
let anime = arn.app.find("anime-link") as HTMLInputElement
let osu = arn.app.find("osu-link") as HTMLInputElement
let soundtrack = {
soundcloud: soundcloud.value,
tags: [anime.value, osu.value],
}
button.innerText = "Adding..."
button.disabled = true
arn.post("/api/soundtrack/new", soundtrack)
.then(() => arn.app.load("/music"))
.catch(err => {
console.error(err)
arn.reloadContent()
})
}
// Search
export function search(arn: AnimeNotifier, search: HTMLInputElement, e: KeyboardEvent) {
if(e.ctrlKey || e.altKey) {