forked from jsnbuchanan/crowd-funder-for-time-pwa
Fix db path; add new pathing for web-push; load VAPID at boot
This commit is contained in:
22
src/App.vue
22
src/App.vue
@@ -261,9 +261,24 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { Vue, Component } from "vue-facing-decorator";
|
||||
import axios from "axios";
|
||||
|
||||
@Component
|
||||
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) => {
|
||||
this.b64 = response.data.vapidKey;
|
||||
console.log(this.b64);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("API error", error);
|
||||
});
|
||||
}
|
||||
|
||||
private askPermission(): Promise<NotificationPermission> {
|
||||
// Check if Notifications are supported
|
||||
if (!("Notification" in window)) {
|
||||
@@ -355,12 +370,9 @@ export default class App extends Vue {
|
||||
private subscribeToPush(): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
if ("serviceWorker" in navigator && "PushManager" in window) {
|
||||
navigator.serviceWorker
|
||||
.register("/service-worker.js")
|
||||
navigator.serviceWorker.ready
|
||||
.then((registration) => {
|
||||
const b64 =
|
||||
"BEl62iUYgUivxIkv69yViEuiBIa-Ib9-SkvMeAtA3LFgDzkrxZJjSgSnfckjBJuBkr3qBUYIHBQFLXYp5Nksh8U";
|
||||
const applicationServerKey = this.urlBase64ToUint8Array(b64);
|
||||
const applicationServerKey = this.urlBase64ToUint8Array(this.b64);
|
||||
|
||||
const options: PushSubscriptionOptions = {
|
||||
userVisibleOnly: true,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Generic strings that could be used throughout the app.
|
||||
*/
|
||||
export enum AppString {
|
||||
APP_NAME = "Kick-Start with Time",
|
||||
APP_NAME = "TimeSafari",
|
||||
|
||||
PROD_ENDORSER_API_SERVER = "https://api.endorser.ch",
|
||||
TEST_ENDORSER_API_SERVER = "https://test-api.endorser.ch",
|
||||
|
||||
Reference in New Issue
Block a user