Fix Notifications page broken page on Safari
Closes #772 Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
c6098b33e3
commit
02187b1158
@ -50,7 +50,7 @@ export async function unsubscribeUserToPush(): Promise<string | undefined> {
|
|||||||
console.log("performing unsubscribeUserToPush");
|
console.log("performing unsubscribeUserToPush");
|
||||||
const registration = await navigator.serviceWorker.ready;
|
const registration = await navigator.serviceWorker.ready;
|
||||||
console.log("found registration", registration);
|
console.log("found registration", registration);
|
||||||
const subscription = await registration.pushManager.getSubscription();
|
const subscription = await registration.pushManager?.getSubscription();
|
||||||
console.log("found subscription", subscription);
|
console.log("found subscription", subscription);
|
||||||
if (subscription && (await subscription?.unsubscribe()) === true) {
|
if (subscription && (await subscription?.unsubscribe()) === true) {
|
||||||
console.log("done unsubscription");
|
console.log("done unsubscription");
|
||||||
|
@ -715,7 +715,7 @@ export default class Notifications extends Vue {
|
|||||||
private async isSubscribed(): Promise<boolean> {
|
private async isSubscribed(): Promise<boolean> {
|
||||||
if (!("serviceWorker" in navigator)) return Promise.resolve(false);
|
if (!("serviceWorker" in navigator)) return Promise.resolve(false);
|
||||||
const registration = await navigator.serviceWorker.getRegistration();
|
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> {
|
private async deleteFeedToken(token: string): Promise<void> {
|
||||||
|
Loading…
Reference in New Issue
Block a user