Better error handler for push notifications subscription
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
ebe2e148d0
commit
54c23c6673
@ -1053,5 +1053,6 @@
|
|||||||
"An error has occured while refreshing the page.": "An error has occured while refreshing the page.",
|
"An error has occured while refreshing the page.": "An error has occured while refreshing the page.",
|
||||||
"Join group {group}": "Join group {group}",
|
"Join group {group}": "Join group {group}",
|
||||||
"Public preview": "Public preview",
|
"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"
|
||||||
}
|
}
|
||||||
|
@ -1144,5 +1144,6 @@
|
|||||||
"An error has occured while refreshing the page.": "Une erreur est survenue lors du rafraîchissement de la page.",
|
"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}",
|
"Join group {group}": "Rejoindre le groupe {group}",
|
||||||
"Public preview": "Aperçu public",
|
"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
|
data?.config?.webPush?.publicKey
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
const pushSubscription = await registration.pushManager.subscribe(
|
try {
|
||||||
subscribeOptions
|
const pushSubscription = await registration.pushManager.subscribe(
|
||||||
);
|
subscribeOptions
|
||||||
console.log(
|
);
|
||||||
"Received PushSubscription: ",
|
console.debug("Received PushSubscription: ", pushSubscription);
|
||||||
JSON.stringify(pushSubscription)
|
return pushSubscription;
|
||||||
);
|
} catch (e) {
|
||||||
return pushSubscription;
|
console.error("Error while subscribing to push notifications", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -597,6 +597,10 @@ export default class Notifications extends Vue {
|
|||||||
});
|
});
|
||||||
this.subscribed = true;
|
this.subscribed = true;
|
||||||
console.log(data);
|
console.log(data);
|
||||||
|
} else {
|
||||||
|
this.$notifier.error(
|
||||||
|
this.$t("Error while subscribing to push notifications") as string
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("can't do webpush");
|
console.log("can't do webpush");
|
||||||
|
Loading…
Reference in New Issue
Block a user