Refactor actions

This commit is contained in:
2017-10-17 11:27:15 +02:00
parent 56815fcb22
commit d65f3fd7bb
16 changed files with 450 additions and 429 deletions

View File

@ -0,0 +1,20 @@
import { AnimeNotifier } from "../AnimeNotifier"
// Enable notifications
export async function enableNotifications(arn: AnimeNotifier, button: HTMLElement) {
await arn.pushManager.subscribe(arn.user.dataset.id)
arn.updatePushUI()
}
// Disable notifications
export async function disableNotifications(arn: AnimeNotifier, button: HTMLElement) {
await arn.pushManager.unsubscribe(arn.user.dataset.id)
arn.updatePushUI()
}
// Test notification
export function testNotification(arn: AnimeNotifier) {
fetch("/api/test/notification", {
credentials: "same-origin"
})
}