diff --git a/app/install/EnableNotifications.tsx b/app/install/EnableNotifications.tsx index 27e9998..cef38a2 100644 --- a/app/install/EnableNotifications.tsx +++ b/app/install/EnableNotifications.tsx @@ -1,4 +1,4 @@ -import React from "react" +import React, { useState } from "react" import { useEffect } from "react" import { usePush } from "../usePush" import { request } from "http" @@ -25,6 +25,8 @@ export default function EnableNotifications({ function EnableButton({ onSubscribe }: { onSubscribe: () => void }) { const { subscribeToPush, requestPermission, canSendPush } = usePush() + const [error, setError] = useState() + function subscribe() { requestPermission() } @@ -40,9 +42,17 @@ function EnableButton({ onSubscribe }: { onSubscribe: () => void }) { subscription, }) onSubscribe() + }, + (error) => { + setError(error) } ) }, [canSendPush]) - return + return ( + <> + +
{error?.toString()}
+ + ) }