forked from jsnbuchanan/crowd-funder-for-time-pwa
reorder home page vapid check to avoid an error on localhost
This commit is contained in:
@@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user