bug fix
This commit is contained in:
@@ -122,11 +122,15 @@ async function sendPushToUser(schema, userId, payload) {
|
||||
keys: { p256dh: sub.webpush_p256dh, auth: sub.webpush_auth },
|
||||
};
|
||||
const body = JSON.stringify({
|
||||
notification: {
|
||||
title: payload.title || 'New Message',
|
||||
body: payload.body || '',
|
||||
},
|
||||
data: {
|
||||
url: payload.url || '/',
|
||||
groupId: payload.groupId ? String(payload.groupId) : '',
|
||||
icon: '/icons/icon-192.png',
|
||||
},
|
||||
});
|
||||
try {
|
||||
await wp.sendNotification(subscription, body, { TTL: 86400, urgency: 'high' });
|
||||
@@ -287,7 +291,10 @@ router.post('/test', authMiddleware, async (req, res) => {
|
||||
try {
|
||||
await wp.sendNotification(
|
||||
subscription,
|
||||
JSON.stringify({ title: 'RosterChirp Test', body: 'Push notifications are working!', url: '/', icon: '/icons/icon-192.png' }),
|
||||
JSON.stringify({
|
||||
notification: { title: 'RosterChirp Test', body: 'Push notifications are working!' },
|
||||
data: { url: '/', icon: '/icons/icon-192.png' },
|
||||
}),
|
||||
{ TTL: 300, urgency: 'high' }
|
||||
);
|
||||
results.push({ device: sub.device, type: 'webpush', status: 'sent' });
|
||||
|
||||
Reference in New Issue
Block a user