Debugging
This commit is contained in:
@@ -329,6 +329,7 @@ export default class App extends Vue {
|
|||||||
})
|
})
|
||||||
.then((subscription) => {
|
.then((subscription) => {
|
||||||
if (subscription) {
|
if (subscription) {
|
||||||
|
console.log(subscription);
|
||||||
return this.sendSubscriptionToServer(subscription);
|
return this.sendSubscriptionToServer(subscription);
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Subscription object is not available.");
|
throw new Error("Subscription object is not available.");
|
||||||
@@ -369,15 +370,15 @@ export default class App extends Vue {
|
|||||||
private subscribeToPush(): Promise<void> {
|
private subscribeToPush(): Promise<void> {
|
||||||
return new Promise<void>((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
if ("serviceWorker" in navigator && "PushManager" in window) {
|
if ("serviceWorker" in navigator && "PushManager" in window) {
|
||||||
navigator.serviceWorker.ready
|
|
||||||
.then((registration) => {
|
|
||||||
const applicationServerKey = this.urlBase64ToUint8Array(this.b64);
|
const applicationServerKey = this.urlBase64ToUint8Array(this.b64);
|
||||||
|
|
||||||
const options: PushSubscriptionOptions = {
|
const options: PushSubscriptionOptions = {
|
||||||
userVisibleOnly: true,
|
userVisibleOnly: true,
|
||||||
applicationServerKey: applicationServerKey,
|
applicationServerKey: applicationServerKey,
|
||||||
};
|
};
|
||||||
|
console.log(options);
|
||||||
|
|
||||||
|
navigator.serviceWorker.ready
|
||||||
|
.then((registration) => {
|
||||||
return registration.pushManager.subscribe(options);
|
return registration.pushManager.subscribe(options);
|
||||||
})
|
})
|
||||||
.then((subscription) => {
|
.then((subscription) => {
|
||||||
@@ -385,7 +386,7 @@ export default class App extends Vue {
|
|||||||
resolve();
|
resolve();
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error("Push subscription failed:", error);
|
console.error("Push subscription failed:", error, options);
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user