diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json index b370a2fa0..01622cc95 100644 --- a/js/src/i18n/en_US.json +++ b/js/src/i18n/en_US.json @@ -1053,5 +1053,6 @@ "An error has occured while refreshing the page.": "An error has occured while refreshing the page.", "Join group {group}": "Join group {group}", "Public preview": "Public preview", - "On {instance} and other federated instances": "On {instance} and other federated instances" + "On {instance} and other federated instances": "On {instance} and other federated instances", + "Error while subscribing to push notifications": "Error while subscribing to push notifications" } diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json index f9f94422c..c4c1ccd82 100644 --- a/js/src/i18n/fr_FR.json +++ b/js/src/i18n/fr_FR.json @@ -45,7 +45,7 @@ "Accessible through link": "Accessible uniquement par lien", "Account": "Compte", "Actions": "Actions", - "Activate browser notification": "Activer le notifications du navigateur", + "Activate browser notification": "Activer les notifications du navigateur", "Activated": "Activé", "Active": "Actif·ive", "Activity": "Activité", @@ -1144,5 +1144,6 @@ "An error has occured while refreshing the page.": "Une erreur est survenue lors du rafraîchissement de la page.", "Join group {group}": "Rejoindre le groupe {group}", "Public preview": "Aperçu public", - "On {instance} and other federated instances": "Sur {instance} et d'autres instances fédérées" + "On {instance} and other federated instances": "Sur {instance} et d'autres instances fédérées", + "Error while subscribing to push notifications": "Erreur lors de la souscriptions aux notifications push" } diff --git a/js/src/services/push-subscription.ts b/js/src/services/push-subscription.ts index afa711ba4..738ecc54c 100644 --- a/js/src/services/push-subscription.ts +++ b/js/src/services/push-subscription.ts @@ -33,14 +33,15 @@ export async function subscribeUserToPush(): Promise { data?.config?.webPush?.publicKey ), }; - const pushSubscription = await registration.pushManager.subscribe( - subscribeOptions - ); - console.log( - "Received PushSubscription: ", - JSON.stringify(pushSubscription) - ); - return pushSubscription; + try { + const pushSubscription = await registration.pushManager.subscribe( + subscribeOptions + ); + console.debug("Received PushSubscription: ", pushSubscription); + return pushSubscription; + } catch (e) { + console.error("Error while subscribing to push notifications", e); + } } return null; } diff --git a/js/src/views/Settings/Notifications.vue b/js/src/views/Settings/Notifications.vue index 99711c055..a4b127c50 100644 --- a/js/src/views/Settings/Notifications.vue +++ b/js/src/views/Settings/Notifications.vue @@ -597,6 +597,10 @@ export default class Notifications extends Vue { }); this.subscribed = true; console.log(data); + } else { + this.$notifier.error( + this.$t("Error while subscribing to push notifications") as string + ); } } else { console.log("can't do webpush");