I need to pass the handleUpdateHours function in my payload below, how can I do
const handleUpdateHours = async () => {
firestore()
.collection('Providers')
.doc(req.body.providerId)
.collection('ServiceHistory')
.doc(req.body.serviceProviderId)
.update({
additionalHours: Number(req.body.hours)
});
firestore()
.collection('Clients')
.doc(req.body.clientId)
.collection('ServiceHistory')
.doc(req.body.serviceClientId)
.update({
additionalHours: Number(req.body.hours)
});
}
payload:
I was trying what's with // commented on the payload but it didn't work.
he is not adding my function to the object I do not receive any error but also does not add the function
const payload = {
tokens: [clientFcmToken],
data: {
// notification: {
// typeObj: () => handleUpdateHours(),
// data: {
// type: () => handleUpdateHours(),
// }
// },
notifee: JSON.stringify({
title: 'O Helper está solicitando horas adicionais ao serviço',
body: 'Você deseja aceitar?',
data: {
type: '() => handleUpdateHours()',
},
// notification: {
// typeObj: () => handleUpdateHours(),
// data: {
// type: () => handleUpdateHours(),
// }
// },
android: {
channelId: 'default',
actions: [
{
title: 'Aceitar',
pressAction: {
id: 'acceptHours',
type: () => handleUpdateHours(),
},
},
{
title: 'Recusar',
pressAction: {
id: 'refuseHours',
},
},
],
},
}),
},
}