From 3fbd5b8622debfc377065f33f8b73d52f0efc90a Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 17 Jan 2024 11:32:16 +0800 Subject: [PATCH] s/allowNofitications/allowNotifications Also very embarrassing --- src/pages/settings.jsx | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/pages/settings.jsx b/src/pages/settings.jsx index feac4742..1d164c8b 100644 --- a/src/pages/settings.jsx +++ b/src/pages/settings.jsx @@ -643,7 +643,7 @@ function PushNotificationsSection({ onClose }) { const { instance } = api(); const [uiState, setUIState] = useState('default'); const pushFormRef = useRef(); - const [allowNofitications, setAllowNotifications] = useState(false); + const [allowNotifications, setAllowNotifications] = useState(false); const [needRelogin, setNeedRelogin] = useState(false); const previousPolicyRef = useRef(); useEffect(() => { @@ -689,7 +689,7 @@ function PushNotificationsSection({ onClose }) { ref={pushFormRef} onChange={() => { const values = Object.fromEntries(new FormData(pushFormRef.current)); - const allowNofitications = !!values['policy-allow']; + const allowNotifications = !!values['policy-allow']; const params = { policy: values.policy, data: { @@ -718,9 +718,13 @@ function PushNotificationsSection({ onClose }) { }); const policyChanged = previousPolicyRef.current !== params.policy; - console.log('PN Form', { values, allowNofitications, params }); + console.log('PN Form', { + values, + allowNotifications: allowNotifications, + params, + }); - if (allowNofitications && alertsCount > 0) { + if (allowNotifications && alertsCount > 0) { if (policyChanged) { console.debug('Policy changed.'); removeSubscription() @@ -754,7 +758,7 @@ function PushNotificationsSection({ onClose }) { type="checkbox" disabled={isLoading || needRelogin} name="policy-allow" - checked={allowNofitications} + checked={allowNotifications} onChange={async (e) => { const { checked } = e.target; if (checked) { @@ -778,7 +782,7 @@ function PushNotificationsSection({ onClose }) { Allow from{' '}