Added user follows

This commit is contained in:
2017-07-21 10:10:48 +02:00
parent 8a72b76d27
commit 524ab3fff9
10 changed files with 126 additions and 18 deletions

View File

@ -580,18 +580,30 @@ export class AnimeNotifier {
})
}
post(url, obj) {
post(url, body) {
if(typeof body !== "string") {
body = JSON.stringify(body)
}
this.loading(true)
return fetch(url, {
method: "POST",
body: JSON.stringify(obj),
body,
credentials: "same-origin"
})
.then(response => response.text())
.then(body => {
this.loading(false)
if(body !== "ok") {
throw body
}
})
.catch(err => {
this.loading(false)
throw err
})
}
scrollTo(target: HTMLElement) {