Browse Source

Adding alert dialogs

pull/92/head
Matthew Raymer 12 months ago
parent
commit
a60beb483c
  1. 8
      src/App.vue

8
src/App.vue

@ -384,16 +384,13 @@ export default class App extends Vue {
this.subscribeToPush()
.then(() => {
console.log("Subscribed successfully.");
// Assuming the subscription object is available
return navigator.serviceWorker.ready;
})
.then((registration) => {
// Fetch the existing subscription object from the registration
return registration.pushManager.getSubscription();
})
.then((subscription) => {
if (subscription) {
console.log(subscription);
return this.sendSubscriptionToServer(subscription);
} else {
throw new Error("Subscription object is not available.");
@ -407,15 +404,16 @@ export default class App extends Vue {
"Subscription or server communication failed:",
error,
);
alert( "Subscription or server communication failed. Try again in a while." );
});
})
.catch((error) => {
console.error("An error occurred:", error);
// Handle error appropriately here
alert( "Some error occurred." + error );
});
}
// Function to convert URL base64 to Uint8Array
private urlBase64ToUint8Array(base64String: string): Uint8Array {
const padding = "=".repeat((4 - (base64String.length % 4)) % 4);
const base64 = (base64String + padding)

Loading…
Cancel
Save