diff --git a/src/components/Modal/ModalConfirmEvent/ModalConfirmEvent.tsx b/src/components/Modal/ModalConfirmEvent/ModalConfirmEvent.tsx index 0d2231d..915344f 100644 --- a/src/components/Modal/ModalConfirmEvent/ModalConfirmEvent.tsx +++ b/src/components/Modal/ModalConfirmEvent/ModalConfirmEvent.tsx @@ -112,11 +112,8 @@ export const ModalConfirmEvent: FC = ({ async function confirmPending() { selectedPendingRequests.forEach((req) => { call(async () => { - if (selectedActionType === ACTION_TYPE.ONCE) { - await swicCall('confirm', req.id, true, false) - } else { - await swicCall('confirm', req.id, true, true) - } + const remember = selectedActionType !== ACTION_TYPE.ONCE + await swicCall('confirm', req.id, true, remember) console.log('confirmed', req.id, selectedActionType) }) }) diff --git a/src/pages/KeyPage/Key.Page.tsx b/src/pages/KeyPage/Key.Page.tsx index 522fb22..2e4195a 100644 --- a/src/pages/KeyPage/Key.Page.tsx +++ b/src/pages/KeyPage/Key.Page.tsx @@ -49,10 +49,10 @@ const KeyPage = () => { MODAL_PARAMS_KEYS.CONFIRM_EVENT, ) - const nofity = useEnqueueSnackbar() + const notify = useEnqueueSnackbar() const [profile, setProfile] = useState(null) - const userName = profile?.info?.name || getShortenNpub(npub) + const userName = profile?.info?.name || profile?.info?.display_name || getShortenNpub(npub) const userNameWithPrefix = userName + '@nsec.app' const [showWarning, setShowWarning] = useState(false) @@ -91,17 +91,13 @@ const KeyPage = () => { const load = useCallback(async () => { try { - const npubToken = npub.includes('#') ? npub.split('#')[0] : npub - const { type, data: pubkey } = nip19.decode(npubToken) - if (type !== 'npub') return undefined - - const response = await fetchProfile(pubkey) + const response = await fetchProfile(npub) setProfile(response as any) } catch (e) { return undefined } // eslint-disable-next-line - }, []) + }, [npub]) useEffect(() => { load() @@ -137,12 +133,12 @@ const KeyPage = () => { setIsLoading(true) await askNotificationPermission() const r = await swicCall('enablePush') - if (!r) return nofity(`Failed to enable push subscription`, 'error') - nofity('Enabled!', 'success') + if (!r) return notify(`Failed to enable push subscription`, 'error') + notify('Enabled!', 'success') checkBackgroundSigning() setIsLoading(false) } catch (e) { - nofity(`Failed to enable push subscription`, 'error') + notify(`Failed to enable push subscription`, 'error') setIsLoading(false) } }