diff --git a/components/push-manager.tsx b/components/push-manager.tsx index 31017b2..4dcca23 100644 --- a/components/push-manager.tsx +++ b/components/push-manager.tsx @@ -63,7 +63,12 @@ export function PushSubscriptionSettings({ planId }: { planId: string }) { async function registerServiceWorker() { try { - const registration = await navigator.serviceWorker.ready + // Explicitly register the service worker + const registration = await navigator.serviceWorker.register('/push-sw.js') + + // Wait for it to be ready + await navigator.serviceWorker.ready + const sub = await registration.pushManager.getSubscription() setSubscription(sub) } catch (e: any) {