Implemented forum likes

This commit is contained in:
2017-07-08 23:27:24 +02:00
parent 7579c52188
commit 1f4dc0a05d
5 changed files with 51 additions and 17 deletions

View File

@ -115,6 +115,24 @@ export function savePost(arn: AnimeNotifier, element: HTMLElement) {
.catch(console.error)
}
// like
export function like(arn: AnimeNotifier, element: HTMLElement) {
let apiEndpoint = arn.findAPIEndpoint(element)
arn.post(apiEndpoint + "/like", null)
.then(() => arn.reloadContent())
.catch(console.error)
}
// unlike
export function unlike(arn: AnimeNotifier, element: HTMLElement) {
let apiEndpoint = arn.findAPIEndpoint(element)
arn.post(apiEndpoint + "/unlike", null)
.then(() => arn.reloadContent())
.catch(console.error)
}
// Forum reply
export function forumReply(arn: AnimeNotifier) {
let textarea = arn.app.find("new-reply") as HTMLTextAreaElement