Fix Notifications page broken page on Safari

Closes #772

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-07-21 12:11:59 +02:00
parent c6098b33e3
commit 02187b1158
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
2 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ export async function unsubscribeUserToPush(): Promise<string | undefined> {
console.log("performing unsubscribeUserToPush");
const registration = await navigator.serviceWorker.ready;
console.log("found registration", registration);
const subscription = await registration.pushManager.getSubscription();
const subscription = await registration.pushManager?.getSubscription();
console.log("found subscription", subscription);
if (subscription && (await subscription?.unsubscribe()) === true) {
console.log("done unsubscription");

View File

@ -715,7 +715,7 @@ export default class Notifications extends Vue {
private async isSubscribed(): Promise<boolean> {
if (!("serviceWorker" in navigator)) return Promise.resolve(false);
const registration = await navigator.serviceWorker.getRegistration();
return (await registration?.pushManager.getSubscription()) != null;
return (await registration?.pushManager?.getSubscription()) != null;
}
private async deleteFeedToken(token: string): Promise<void> {