.
This commit is contained in:
parent
426ddffa5f
commit
5e885ff3b4
@ -97,6 +97,7 @@ const extraControllers = {
|
||||
to: userDevice.token,
|
||||
sound: 'default',
|
||||
notificationId: notificationRecord.id,
|
||||
data: notificationRecord.data,
|
||||
});
|
||||
});
|
||||
|
||||
@ -187,15 +188,15 @@ const extraControllers = {
|
||||
|
||||
// Buscamos el token y el usuario
|
||||
console.log('>> Busco el usuario y el token', params.params);
|
||||
let result = await notificationService.fetchOne(params, context);
|
||||
let result = await userDeviceService.fetchOne(params, context);
|
||||
if (!result) {
|
||||
// Dar de alta el token
|
||||
console.log('>> Dar de alta el token', data);
|
||||
result = await notificationService.create(data, context);
|
||||
result = await userDeviceService.create(data, context);
|
||||
} else {
|
||||
// Actualizar el token
|
||||
console.log('>> Actualizar el token', params.params, data, context);
|
||||
result = await notificationService.update(params.params, data, context);
|
||||
result = await userDeviceService.update(params.params, data, context);
|
||||
}
|
||||
} catch(error) {
|
||||
console.error(error);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user