From 30d9b9cdbcd0b474e3953c3fed6b8e247c34ce34 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Tue, 20 Mar 2018 18:52:35 +0100 Subject: [PATCH] Add status message when liking stuff --- scripts/Actions/Like.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/Actions/Like.ts b/scripts/Actions/Like.ts index 22783139..61d83bbf 100644 --- a/scripts/Actions/Like.ts +++ b/scripts/Actions/Like.ts @@ -1,19 +1,19 @@ import { AnimeNotifier } from "../AnimeNotifier" // like -export function like(arn: AnimeNotifier, element: HTMLElement) { - let apiEndpoint = arn.findAPIEndpoint(element) +export async function like(arn: AnimeNotifier, element: HTMLElement) { + arn.statusMessage.showInfo("Liked!") - arn.post(apiEndpoint + "/like", null) - .then(() => arn.reloadContent()) - .catch(err => arn.statusMessage.showError(err)) + let apiEndpoint = arn.findAPIEndpoint(element) + await arn.post(apiEndpoint + "/like", null).catch(err => arn.statusMessage.showError(err)) + arn.reloadContent() } // unlike -export function unlike(arn: AnimeNotifier, element: HTMLElement) { - let apiEndpoint = arn.findAPIEndpoint(element) +export async function unlike(arn: AnimeNotifier, element: HTMLElement) { + arn.statusMessage.showInfo("Disliked!") - arn.post(apiEndpoint + "/unlike", null) - .then(() => arn.reloadContent()) - .catch(err => arn.statusMessage.showError(err)) + let apiEndpoint = arn.findAPIEndpoint(element) + await arn.post(apiEndpoint + "/unlike", null).catch(err => arn.statusMessage.showError(err)) + arn.reloadContent() } \ No newline at end of file