requestPermissions does not return a promise apparently
Test / test (push) Failing after 41s
Details
Test / test (push) Failing after 41s
Details
This commit is contained in:
parent
829c1ad343
commit
0c79ef491b
|
|
@ -72,13 +72,16 @@ function LandingMessage({ isSupported }: { isSupported: boolean }) {
|
|||
}
|
||||
|
||||
function EnableButton({ onSubscribe }: { onSubscribe: () => void }) {
|
||||
const { subscribeToPush, requestPermission } = usePush()
|
||||
|
||||
return <button onClick={subscribe}>Enable notifications</button>
|
||||
const { subscribeToPush, requestPermission, canSendPush } = usePush()
|
||||
|
||||
async function subscribe() {
|
||||
console.log("Hey the thing was clicked wow")
|
||||
await requestPermission()
|
||||
requestPermission()
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (!canSendPush) return
|
||||
|
||||
subscribeToPush(
|
||||
urlB64ToUint8Array(applicationServerPublicKey) as any,
|
||||
(subscription) => {
|
||||
|
|
@ -94,7 +97,9 @@ function EnableButton({ onSubscribe }: { onSubscribe: () => void }) {
|
|||
document.appendChild(errorDiv)
|
||||
}
|
||||
)
|
||||
}
|
||||
}, [canSendPush])
|
||||
|
||||
return <button onClick={subscribe}>Enable notifications</button>
|
||||
}
|
||||
|
||||
const applicationServerPublicKey =
|
||||
|
|
|
|||
Loading…
Reference in New Issue