Improved soundtracks

This commit is contained in:
2017-10-15 20:19:45 +02:00
parent c0b28c9b0a
commit d1c26252ac
11 changed files with 60 additions and 26 deletions

@ -671,7 +671,7 @@ export class AnimeNotifier {
post(url: string, body: any) {
if(this.isLoading) {
return Promise.resolve()
return Promise.resolve(null)
}
if(typeof body !== "string") {
@ -685,13 +685,16 @@ export class AnimeNotifier {
body,
credentials: "same-origin"
})
.then(response => response.text())
.then(body => {
.then(response => {
this.loading(false)
if(body !== "ok") {
throw body
if(response.status === 200) {
return Promise.resolve(response)
}
return response.text().then(err => {
throw err
})
})
.catch(err => {
this.loading(false)