17 lines
698 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
// Follow user
export function followUser(arn: AnimeNotifier, elem: HTMLElement) {
return arn.post(elem.dataset.api, "")
.then(() => arn.reloadContent())
2018-04-02 05:44:11 +00:00
.then(() => arn.statusMessage.showInfo("You are now following " + document.getElementById("nick").innerText + "."))
2017-10-17 09:27:15 +00:00
.catch(err => arn.statusMessage.showError(err))
}
// Unfollow user
export function unfollowUser(arn: AnimeNotifier, elem: HTMLElement) {
return arn.post(elem.dataset.api, "")
.then(() => arn.reloadContent())
2018-04-02 05:44:11 +00:00
.then(() => arn.statusMessage.showInfo("You stopped following " + document.getElementById("nick").innerText + "."))
2017-10-17 09:27:15 +00:00
.catch(err => arn.statusMessage.showError(err))
}