diff --git a/src/subscriptions.js b/src/subscriptions.js index b1f13791dd836e1fe49b9818dc3214436b99e237..fd4cf6722414ea07041bdaf9359d67bbccc78fc0 100644 --- a/src/subscriptions.js +++ b/src/subscriptions.js @@ -54,13 +54,13 @@ export default class Subscriptions { const subscriptions = this.getSubscriptionsFromStorage(); if (this.isSubscribed()) { - const endpoint = subscriptions[this.hubId].endpoint; - this.hubChannel.unsubscribe(endpoint); + const subscription = await this.registration.pushManager.getSubscription(); + this.hubChannel.unsubscribe(subscription); delete subscriptions[this.hubId]; if (Object.keys(subscriptions).length === 0) { - this.registration.pushManager.unregister(endpoint); + subscription.unsubscribe(); } } else { let subscription = await this.registration.pushManager.getSubscription(); diff --git a/src/utils/hub-channel.js b/src/utils/hub-channel.js index 9e98d8e091bf0da5d2006e26853e417e7b418ed4..76d6b891baebbe797b602719df99b1b7683b908a 100644 --- a/src/utils/hub-channel.js +++ b/src/utils/hub-channel.js @@ -95,8 +95,8 @@ export default class HubChannel { this.channel.push("subscribe", { subscription }); }; - unsubscribe = endpoint => { - this.channel.push("unsubscribe", { endpoint }); + unsubscribe = subscription => { + this.channel.push("unsubscribe", { subscription }); }; sendMessage = body => {