diff options
-rw-r--r-- | modern/src/index.js | 30 | ||||
-rw-r--r-- | web/l10n/es.json | 14 |
2 files changed, 37 insertions, 7 deletions
diff --git a/modern/src/index.js b/modern/src/index.js index 32cf990..c7123ed 100644 --- a/modern/src/index.js +++ b/modern/src/index.js @@ -16,4 +16,34 @@ ReactDOM.render(( </Provider> ), document.getElementById('root')); +window.updateNotificationToken = async (token) => { + // Get user attributes + const response = await fetch('/api/session', { + headers: { Accept: 'application/json' } + }); + if (response.ok) { + let user = await response.json(); + if (user.attributes) { + if (!user.attributes.notificationTokens || user.attributes.notificationTokens.indexOf(token) < 0) { + if (!user.attributes.notificationTokens) { + user.attributes.notificationTokens = token; + } else { + user.attributes.notificationTokens += ',' + token; + } + + // Set user attributes + const response2 = await fetch(`/api/users/${user.id}`, { + method: 'PUT', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + }, + body: JSON.stringify(user), + }); + console.log ('Set token: ', await response2.json()); + } + } + } +} + serviceWorker.unregister(); diff --git a/web/l10n/es.json b/web/l10n/es.json index 859d4cf..2ca6e43 100644 --- a/web/l10n/es.json +++ b/web/l10n/es.json @@ -28,8 +28,8 @@ "sharedName": "Nombre", "sharedDescription": "Descripción", "sharedSearch": "Buscar", - "sharedGeofence": "Geo-Zona", - "sharedGeofences": "Geo-Zonas", + "sharedGeofence": "Geocerca", + "sharedGeofences": "Geocercas", "sharedNotifications": "Notificaciones", "sharedNotification": "Notificación", "sharedAttributes": "Atributos", @@ -345,8 +345,8 @@ "eventDeviceOverspeed": "Excedido el límite de Velocidad", "eventDeviceFuelDrop": "Perdida de Combustible ", "eventCommandResult": "Resultado del comando", - "eventGeofenceEnter": "Entrada en la Geo-Zona", - "eventGeofenceExit": "Salida de la Geo-Zona", + "eventGeofenceEnter": "Entrada en la Geocerca", + "eventGeofenceExit": "Salida de la Geocerca", "eventAlarm": "Alarma ", "eventIgnitionOn": "Llave encendido ON", "eventIgnitionOff": "Llave encendido OFF", @@ -369,9 +369,9 @@ "alarmDoor": "Puerta", "alarmLock": "Bloqueado", "alarmUnlock": "Desbloquear", - "alarmGeofence": "Geo-Zona", - "alarmGeofenceEnter": "El Dispositivo ha entrado a la Geo-Zona", - "alarmGeofenceExit": "El Dispositivo ha salido de la Geo-Zona", + "alarmGeofence": "Geocerca", + "alarmGeofenceEnter": "El Dispositivo ha entrado a la Geocerca", + "alarmGeofenceExit": "El Dispositivo ha salido de la Geocerca", "alarmGpsAntennaCut": "Antena del GPS Cortada ", "alarmAccident": "Accidente", "alarmTow": "Grúa de arrastre", |