forked from jsnbuchanan/crowd-funder-for-time-pwa
reorder home page vapid check to avoid an error on localhost
This commit is contained in:
41
src/App.vue
41
src/App.vue
@@ -340,25 +340,30 @@ export default class App extends Vue {
|
|||||||
pushUrl = settings.webPushServer;
|
pushUrl = settings.webPushServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
await axios
|
if (pushUrl.startsWith("http://localhost")) {
|
||||||
.get(pushUrl + "/web-push/vapid")
|
console.log("Not checking for VAPID in this local environment.");
|
||||||
.then((response: VapidResponse) => {
|
} else {
|
||||||
this.b64 = response.data?.vapidKey || "";
|
await axios
|
||||||
console.log("Got vapid key:", this.b64);
|
.get(pushUrl + "/web-push/vapid")
|
||||||
navigator.serviceWorker.addEventListener("controllerchange", () => {
|
.then((response: VapidResponse) => {
|
||||||
console.log("New service worker is now controlling the page");
|
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) {
|
||||||
if (!this.b64) {
|
this.$notify(
|
||||||
this.$notify(
|
{
|
||||||
{
|
group: "alert",
|
||||||
group: "alert",
|
type: "danger",
|
||||||
type: "danger",
|
title: "Error Setting Notifications",
|
||||||
title: "Error Setting Notifications",
|
text: "Could not set notifications.",
|
||||||
text: "Could not set notifications.",
|
},
|
||||||
},
|
-1,
|
||||||
-1,
|
);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (window.location.host.startsWith("localhost")) {
|
if (window.location.host.startsWith("localhost")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user