diff --git a/src/App.vue b/src/App.vue index 7fb6f73..9abe774 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",