27 lines
661 B
TypeScript

import AnimeNotifier from "../AnimeNotifier"
// like
export async function like(arn: AnimeNotifier, element: HTMLElement) {
arn.statusMessage.showInfo("Liked!", 1000)
let apiEndpoint = arn.findAPIEndpoint(element)
try {
await arn.post(apiEndpoint + "/like", null)
arn.reloadContent()
} catch(err) {
arn.statusMessage.showError(err)
}
}
// unlike
export async function unlike(arn: AnimeNotifier, element: HTMLElement) {
arn.statusMessage.showInfo("Disliked!", 1000)
let apiEndpoint = arn.findAPIEndpoint(element)
try {
await arn.post(apiEndpoint + "/unlike", null)
arn.reloadContent()
} catch(err) {
arn.statusMessage.showError(err)
}
}