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 sendWebNotification = async (subscription, title, body) => {
|
||||
const payload = JSON.stringify({
|
||||
title,
|
||||
body
|
||||
});
|
||||
webPush.sendNotification(subscription, payload);
|
||||
try {
|
||||
const payload = JSON.stringify({
|
||||
title,
|
||||
body
|
||||
});
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user