From 2eaa4203aa0bd536f3fef83caea09e53f13f1fa5 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Tue, 12 Sep 2023 08:03:03 -0400 Subject: [PATCH] Debugging and ironing out the flow --- src/App.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/App.vue b/src/App.vue index 7fb6f7391..9abe7748f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -267,7 +267,6 @@ import axios from "axios"; export default class App extends Vue { b64 = ""; mounted() { - // Your API call logic here axios .get("https://timesafari-pwa.anomalistlabs.com/web-push/vapid") .then((response) => { @@ -372,12 +371,14 @@ export default class App extends Vue { if ("serviceWorker" in navigator && "PushManager" in window) { navigator.serviceWorker.ready .then((registration) => { + console.log(this.b64); const applicationServerKey = this.urlBase64ToUint8Array(this.b64); const options: PushSubscriptionOptions = { userVisibleOnly: true, applicationServerKey: applicationServerKey, }; + console.log(options); return registration.pushManager.subscribe(options); }) @@ -400,8 +401,8 @@ export default class App extends Vue { private sendSubscriptionToServer( subscription: PushSubscription, ): Promise { - // Simulated API call - return fetch("/api/save-subscription", { + console.log(subscription); + return fetch("/web-push/subscribe", { method: "POST", headers: { "Content-Type": "application/json",