add services/message-delivery-method-web-push/test-send-notification.js
Main daploy / deploy (push) Successful in 48s

This commit is contained in:
2024-11-24 11:51:45 +02:00
parent 89ec27ed23
commit 46c26e28e3
17 changed files with 272 additions and 90 deletions
@@ -13,6 +13,8 @@ import { type QRCodeDocument } from '@/types/DBDocumentTypes'
import { type DeliveryOption, DELIVERY_METHOD_WEB_PUSH } from '@/constants/deliveryOptions'
import { ref } from 'vue'
import { saveWebPushSubscription } from '@/api/webPush'
type DeliveryOptionWebPush = Extract<DeliveryOption, { method: typeof DELIVERY_METHOD_WEB_PUSH }>
defineProps<{
@@ -61,30 +63,7 @@ async function requestNotificationPermission(): Promise<boolean> {
'BMPwpR1Q24ZOFxy2T9M-I-Y6F6bucsHFVZKP8QYslgD_4hGCDv16qnZnji-ldngcZ_vBWVBwJ6OIfknVBnCxLsY',
})
console.log('Push-подписка создана:', subscription)
console.log(JSON.stringify(subscription))
// subscription = {
// endpoint:
// 'https://jmt17.google.com/fcm/send/eFYnP7qxt8A:APA91bHYGItzGpnzhXkfKzgMhAXgwcQXaLuRLqq9mt9RPS0VgGpEvVASxW8AF_fJmtSBtK-po0V3mM7fGWSN6tMCrImZqgZG14kGv0chQoghOLuWgHTUQYtQEqhd6f89eVonJdtjAlDN',
// expirationTime: null,
// keys: {
// p256dh:
// 'BAIGLAQ5cZg6e8psnK6vy_MJ1kUJbs2Tymjc38-_6zM1VQXWP2Yj-604uPMye4smHosNKmBEPRDJJOH6Wxr1MLQ',
// auth: '1k48wvT0U3pK_xaXW95Ekw',
// },
// }
// subscription = {
// endpoint:
// 'https://jmt17.google.com/fcm/send/eFYnP7qxt8A:APA91bHYGItzGpnzhXkfKzgMhAXgwcQXaLuRLqq9mt9RPS0VgGpEvVASxW8AF_fJmtSBtK-po0V3mM7fGWSN6tMCrImZqgZG14kGv0chQoghOLuWgHTUQYtQEqhd6f89eVonJdtjAlDN',
// expirationTime: null,
// keys: {
// p256dh:
// 'BAIGLAQ5cZg6e8psnK6vy_MJ1kUJbs2Tymjc38-_6zM1VQXWP2Yj-604uPMye4smHosNKmBEPRDJJOH6Wxr1MLQ',
// auth: '1k48wvT0U3pK_xaXW95Ekw',
// },
// }
// Здесь вы можете сохранить подписку на сервере
await saveWebPushSubscription(subscription)
return true
} catch (err) {
console.error('Ошибка при создании Push-подписки:', err)