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 }) {
|
function EnableButton({ onSubscribe }: { onSubscribe: () => void }) {
|
||||||
const { subscribeToPush, requestPermission } = usePush()
|
const { subscribeToPush, requestPermission, canSendPush } = usePush()
|
||||||
|
|
||||||
return <button onClick={subscribe}>Enable notifications</button>
|
|
||||||
|
|
||||||
async function subscribe() {
|
async function subscribe() {
|
||||||
console.log("Hey the thing was clicked wow")
|
console.log("Hey the thing was clicked wow")
|
||||||
await requestPermission()
|
requestPermission()
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!canSendPush) return
|
||||||
|
|
||||||
subscribeToPush(
|
subscribeToPush(
|
||||||
urlB64ToUint8Array(applicationServerPublicKey) as any,
|
urlB64ToUint8Array(applicationServerPublicKey) as any,
|
||||||
(subscription) => {
|
(subscription) => {
|
||||||
|
|
@ -94,7 +97,9 @@ function EnableButton({ onSubscribe }: { onSubscribe: () => void }) {
|
||||||
document.appendChild(errorDiv)
|
document.appendChild(errorDiv)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}, [canSendPush])
|
||||||
|
|
||||||
|
return <button onClick={subscribe}>Enable notifications</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
const applicationServerPublicKey =
|
const applicationServerPublicKey =
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue