✨ (notification) add img to notification
This commit is contained in:
@@ -20,27 +20,32 @@ export const notify = (
|
||||
title: string,
|
||||
options?: NotificationOptions | undefined
|
||||
) => {
|
||||
try {
|
||||
console.log(showNotification)
|
||||
|
||||
const showCustomNotification = (
|
||||
title: string,
|
||||
options?: NotificationOptions | undefined
|
||||
) => {
|
||||
if (!showNotification) {
|
||||
return
|
||||
}
|
||||
showNotification(title, {
|
||||
icon: '/img/icons/apple-touch-icon.png',
|
||||
...options
|
||||
})
|
||||
}
|
||||
|
||||
try {
|
||||
if (!('Notification' in window)) {
|
||||
return
|
||||
} else if (Notification.permission === 'granted') {
|
||||
showNotification(title, options)
|
||||
showCustomNotification(title, options)
|
||||
} else if (Notification.permission !== 'denied') {
|
||||
Notification.requestPermission((permission: any) => {
|
||||
if (!showNotification) {
|
||||
return
|
||||
}
|
||||
if (!('permission' in Notification)) {
|
||||
Notification.permission = permission
|
||||
}
|
||||
|
||||
if (permission === 'granted') {
|
||||
showNotification(title, options)
|
||||
showCustomNotification(title, options)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user