send test push notifications to specific users only

This commit is contained in:
Dobromir Popov
2024-06-17 21:08:03 +03:00
parent 94597e2440
commit 090b1704d3
3 changed files with 16 additions and 3 deletions

View File

@ -114,7 +114,7 @@ const Notification = async (req, res) => {
}
else if (id) {
console.log('Sending push notification to publisher ', id)
await sendPush(id, title, message.actions)
await sendPush(id, title, message, actions)
res.statusCode = 200
res.end()
return

View File

@ -833,7 +833,20 @@ export default function CalendarPage({ initialEvents, initialShifts }) {
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ broadcast: true, message: "Тестово съобщение", title: "Това е тестово съобщение от https://sofia.mwitnessing.com" })
body: JSON.stringify({
id: pub.id, message: "Тестово съобщение", title: "Това е тестово съобщение от https://sofia.mwitnessing.com", actions: [
{
action: 'open_url',
title: 'Open URL',
icon: '/images/open-url.png'
},
{
action: 'dismiss',
title: 'Dismiss',
icon: '/images/dismiss.png'
}
]
})
})
}}
>+</button>

View File

@ -108,7 +108,7 @@ export default function DashboardPage({ initialItems, initialUserId, cartEvents,
toast(content, {
toastId,
autoClose: false, // Keep the toast open until manually closed
closeButton: true,
closeButton: false,
onClose: () => handleClose(toastId),
});
});