import { AnimeNotifier } from "../AnimeNotifier"

// like
export function like(arn: AnimeNotifier, element: HTMLElement) {
	let apiEndpoint = arn.findAPIEndpoint(element)

	arn.post(apiEndpoint + "/like", null)
	.then(() => arn.reloadContent())
	.catch(err => arn.statusMessage.showError(err))
}

// unlike
export function unlike(arn: AnimeNotifier, element: HTMLElement) {
	let apiEndpoint = arn.findAPIEndpoint(element)

	arn.post(apiEndpoint + "/unlike", null)
	.then(() => arn.reloadContent())
	.catch(err => arn.statusMessage.showError(err))
}
import { AnimeNotifier } from "../AnimeNotifier"

// like
export async function like(arn: AnimeNotifier, element: HTMLElement) {
	arn.statusMessage.showInfo("Liked!")

	let apiEndpoint = arn.findAPIEndpoint(element)
	await arn.post(apiEndpoint + "/like", null).catch(err => arn.statusMessage.showError(err))
	arn.reloadContent()
}

// unlike
export async function unlike(arn: AnimeNotifier, element: HTMLElement) {
	arn.statusMessage.showInfo("Disliked!")

	let apiEndpoint = arn.findAPIEndpoint(element)
	await arn.post(apiEndpoint + "/unlike", null).catch(err => arn.statusMessage.showError(err))
	arn.reloadContent()
}
Add status message when liking stuff
Add status message when liking stuff
