diff --git a/src/App.vue b/src/App.vue index d8ee88662..6861e8414 100644 --- a/src/App.vue +++ b/src/App.vue @@ -340,25 +340,30 @@ export default class App extends Vue { pushUrl = settings.webPushServer; } - await axios - .get(pushUrl + "/web-push/vapid") - .then((response: VapidResponse) => { - this.b64 = response.data?.vapidKey || ""; - console.log("Got vapid key:", this.b64); - navigator.serviceWorker.addEventListener("controllerchange", () => { - console.log("New service worker is now controlling the page"); + if (pushUrl.startsWith("http://localhost")) { + console.log("Not checking for VAPID in this local environment."); + } else { + await axios + .get(pushUrl + "/web-push/vapid") + .then((response: VapidResponse) => { + this.b64 = response.data?.vapidKey || ""; + console.log("Got vapid key:", this.b64); + console.log("response...", response); + navigator.serviceWorker.addEventListener("controllerchange", () => { + console.log("New service worker is now controlling the page"); + }); }); - }); - if (!this.b64) { - this.$notify( - { - group: "alert", - type: "danger", - title: "Error Setting Notifications", - text: "Could not set notifications.", - }, - -1, - ); + if (!this.b64) { + this.$notify( + { + group: "alert", + type: "danger", + title: "Error Setting Notifications", + text: "Could not set notifications.", + }, + -1, + ); + } } } catch (error) { if (window.location.host.startsWith("localhost")) {