Caught errors on webpush
This commit is contained in:
@@ -4,11 +4,16 @@ const { Expo } = require('expo-server-sdk');
|
|||||||
const webPush = require('web-push');
|
const webPush = require('web-push');
|
||||||
|
|
||||||
const sendWebNotification = async (subscription, title, body) => {
|
const sendWebNotification = async (subscription, title, body) => {
|
||||||
|
try {
|
||||||
const payload = JSON.stringify({
|
const payload = JSON.stringify({
|
||||||
title,
|
title,
|
||||||
body
|
body
|
||||||
});
|
});
|
||||||
webPush.sendNotification(subscription, payload);
|
webPush.sendNotification(subscription, payload);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error sending web notification', error);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Expo API to send push notifications, this code was a provided snipped
|
// Expo API to send push notifications, this code was a provided snipped
|
||||||
|
|||||||
Reference in New Issue
Block a user