From d07fb47721d43a97f933454c5dd324478db6890e Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Wed, 4 Oct 2023 22:16:58 -0400 Subject: [PATCH] Debugging --- src/App.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/App.vue b/src/App.vue index 143e7ae7..b732aee6 100644 --- a/src/App.vue +++ b/src/App.vue @@ -329,6 +329,7 @@ export default class App extends Vue { }) .then((subscription) => { if (subscription) { + console.log(subscription); return this.sendSubscriptionToServer(subscription); } else { throw new Error("Subscription object is not available."); @@ -369,15 +370,15 @@ export default class App extends Vue { private subscribeToPush(): Promise { return new Promise((resolve, reject) => { if ("serviceWorker" in navigator && "PushManager" in window) { + const applicationServerKey = this.urlBase64ToUint8Array(this.b64); + const options: PushSubscriptionOptions = { + userVisibleOnly: true, + applicationServerKey: applicationServerKey, + }; + console.log(options); + navigator.serviceWorker.ready .then((registration) => { - const applicationServerKey = this.urlBase64ToUint8Array(this.b64); - - const options: PushSubscriptionOptions = { - userVisibleOnly: true, - applicationServerKey: applicationServerKey, - }; - return registration.pushManager.subscribe(options); }) .then((subscription) => { @@ -385,7 +386,7 @@ export default class App extends Vue { resolve(); }) .catch((error) => { - console.error("Push subscription failed:", error); + console.error("Push subscription failed:", error, options); reject(error); }); } else {