aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-03 13:56:55 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-03 13:56:55 -0600
commit79a6c4f12df873c4087b143bdee3fb0a0bb801f4 (patch)
treed93a635cf2ba0746f008cc49acb92354ed76fddd
parente2ae92ef37d0f5016b8e8375d8657ea125571634 (diff)
downloadetbsa-traccar-web-79a6c4f12df873c4087b143bdee3fb0a0bb801f4.tar.gz
etbsa-traccar-web-79a6c4f12df873c4087b143bdee3fb0a0bb801f4.tar.bz2
etbsa-traccar-web-79a6c4f12df873c4087b143bdee3fb0a0bb801f4.zip
Reworded Spanish translations and added updateNotificationToken() method to window
-rw-r--r--modern/src/index.js30
-rw-r--r--web/l10n/es.json14
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",