fix(pwa): 🐛 wait for sw registration to be active before subscribe to webpush
This commit is contained in:
parent
1f7825e22c
commit
82906907e2
|
|
@ -34,6 +34,7 @@ export default function RegisterServiceWorker() {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (registration.active === null) return
|
||||||
const subscription = await getSubscription()
|
const subscription = await getSubscription()
|
||||||
await requestApi('webpush/subscription', 'POST', subscription)
|
await requestApi('webpush/subscription', 'POST', subscription)
|
||||||
} catch (cause) {
|
} catch (cause) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue