Merge branch 'debug-webpush' into 'master'
Better error handler for push notifications subscription See merge request framasoft/mobilizon!952
This commit is contained in:
commit
9ff66dc356
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -33,14 +33,15 @@ export async function subscribeUserToPush(): Promise<PushSubscription | null> {
|
|||
data?.config?.webPush?.publicKey
|
||||
),
|
||||
};
|
||||
try {
|
||||
const pushSubscription = await registration.pushManager.subscribe(
|
||||
subscribeOptions
|
||||
);
|
||||
console.log(
|
||||
"Received PushSubscription: ",
|
||||
JSON.stringify(pushSubscription)
|
||||
);
|
||||
console.debug("Received PushSubscription: ", pushSubscription);
|
||||
return pushSubscription;
|
||||
} catch (e) {
|
||||
console.error("Error while subscribing to push notifications", e);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue