Check userId set in sendUserNotification (#949)
This commit is contained in:
parent
889d494eaf
commit
01d779723f
|
@ -85,6 +85,9 @@ const sendNotification = (subscription, payload) => {
|
||||||
|
|
||||||
async function sendUserNotification (userId, notification) {
|
async function sendUserNotification (userId, notification) {
|
||||||
try {
|
try {
|
||||||
|
if (!userId) {
|
||||||
|
throw new Error('user id is required')
|
||||||
|
}
|
||||||
notification.data ??= {}
|
notification.data ??= {}
|
||||||
if (notification.item) {
|
if (notification.item) {
|
||||||
notification.data.url ??= await createItemUrl(notification.item)
|
notification.data.url ??= await createItemUrl(notification.item)
|
||||||
|
|
Loading…
Reference in New Issue