Skip to content

Commit

Permalink
copy: translate backend push notification title
Browse files Browse the repository at this point in the history
  • Loading branch information
th0rgall committed Oct 9, 2023
1 parent 66d4209 commit 2f22132
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/src/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@ const { getMessaging } = require('firebase-admin/messaging');
* @returns
*/
exports.sendNotification = async (config) => {
const { fcmToken, senderName, message, messageUrl } = config;
const { fcmToken, senderName, message, messageUrl, language } = config;

const messageFrom = { en: 'Message from', nl: 'Bericht van', fr: 'Message de' }[language ?? 'en'];

/**
* @type {import('firebase-admin/messaging').Message}
*/
const fcmPayload = {
notification: {
title: `Message from ${senderName}`,
title: `${messageFrom} ${senderName}`,
body: message
},
webpush: {
Expand Down

0 comments on commit 2f22132

Please sign in to comment.