From a60beb483cacc5de76bc88792c4b57d5d9dac9e4 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Fri, 8 Dec 2023 23:05:24 -0500 Subject: [PATCH] Adding alert dialogs --- src/App.vue | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/App.vue b/src/App.vue index 038ae3f..31bbc32 100644 --- a/src/App.vue +++ b/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)