fix: wip
This commit is contained in:
parent
6c1bb2fa3d
commit
5a5a49634a
1 changed files with 12 additions and 1 deletions
|
|
@ -169,11 +169,22 @@ async function pushNotification({
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prepare data payload - Firebase requires all values to be strings and no undefined values
|
||||||
|
const dataPayload = {
|
||||||
|
json: JSON.stringify(data),
|
||||||
|
uid,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only add actionId if it's defined
|
||||||
|
if (notification?.actionId) {
|
||||||
|
dataPayload.actionId = String(notification.actionId)
|
||||||
|
}
|
||||||
|
|
||||||
// Construct message according to Firebase Admin SDK format
|
// Construct message according to Firebase Admin SDK format
|
||||||
// https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.basemessage
|
// https://firebase.google.com/docs/reference/admin/node/firebase-admin.messaging.basemessage
|
||||||
const message = {
|
const message = {
|
||||||
token: fcmToken,
|
token: fcmToken,
|
||||||
data: { json: JSON.stringify(data), uid, actionId: notification?.actionId },
|
data: dataPayload,
|
||||||
// Platform specific configurations
|
// Platform specific configurations
|
||||||
android: derivedNotification.android,
|
android: derivedNotification.android,
|
||||||
apns: derivedNotification.apns,
|
apns: derivedNotification.apns,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue