♻️ (notification)

This commit is contained in:
2021-02-28 17:26:36 +01:00
parent 2cc22b29f1
commit 7039c86b4f

View File

@@ -9,22 +9,17 @@ export const setNotificationInstance = (sn: ShowNotification) => {
showNotification = sn
}
export const notify: ShowNotification = async (
title: string,
options?: NotificationOptions
) => {
const showCustomNotification = (
title: string,
options?: NotificationOptions
) => {
export const notify: ShowNotification = async (title, options?) => {
const showCustomNotification = async () => {
if (!showNotification) {
return
}
showNotification(title, {
await showNotification(title, {
icon: '/img/icons/apple-touch-icon.png',
badge: '/img/badge.png',
tag: 'binome',
renotify: true,
silent: true,
...options
})
}
@@ -35,7 +30,7 @@ export const notify: ShowNotification = async (
}
if (Notification.permission === 'granted') {
showCustomNotification(title, options)
showCustomNotification()
return
}
@@ -43,7 +38,7 @@ export const notify: ShowNotification = async (
const permission = await Notification.requestPermission()
if (permission === 'granted') {
showCustomNotification(title, options)
showCustomNotification()
}
}
} catch (error) {