19 lines
617 B
TypeScript
Raw Normal View History

2018-04-02 05:34:16 +00:00
import AnimeNotifier from "../AnimeNotifier"
2017-10-17 09:27:15 +00:00
// like
2018-03-20 17:52:35 +00:00
export async function like(arn: AnimeNotifier, element: HTMLElement) {
arn.statusMessage.showInfo("Liked!")
2017-10-17 09:27:15 +00:00
2018-03-20 17:52:35 +00:00
let apiEndpoint = arn.findAPIEndpoint(element)
await arn.post(apiEndpoint + "/like", null).catch(err => arn.statusMessage.showError(err))
arn.reloadContent()
2017-10-17 09:27:15 +00:00
}
// unlike
2018-03-20 17:52:35 +00:00
export async function unlike(arn: AnimeNotifier, element: HTMLElement) {
arn.statusMessage.showInfo("Disliked!")
2017-10-17 09:27:15 +00:00
2018-03-20 17:52:35 +00:00
let apiEndpoint = arn.findAPIEndpoint(element)
await arn.post(apiEndpoint + "/unlike", null).catch(err => arn.statusMessage.showError(err))
arn.reloadContent()
2017-10-17 09:27:15 +00:00
}