19 lines
629 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) {
2018-04-19 14:23:14 +00:00
arn.statusMessage.showInfo("Liked!", 1000)
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) {
2018-04-19 14:23:14 +00:00
arn.statusMessage.showInfo("Disliked!", 1000)
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
}