Browse Source

reorder home page vapid check to avoid an error on localhost

kb/add-usage-guide
Trent Larson 6 months ago
parent
commit
2ae165d56f
  1. 5
      src/App.vue

5
src/App.vue

@ -340,11 +340,15 @@ export default class App extends Vue {
pushUrl = settings.webPushServer;
}
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");
});
@ -360,6 +364,7 @@ export default class App extends Vue {
-1,
);
}
}
} catch (error) {
if (window.location.host.startsWith("localhost")) {
console.log("Ignoring the error getting VAPID for local development.");

Loading…
Cancel
Save