diff --git a/src/actions/nostr.ts b/src/actions/nostr.ts index 82e1006e3..d82fa49f4 100644 --- a/src/actions/nostr.ts +++ b/src/actions/nostr.ts @@ -3,7 +3,6 @@ import { nip19 } from 'nostr-tools'; import { type AppDispatch } from 'soapbox/store'; import { verifyCredentials } from './auth'; -import { closeModal } from './modals'; /** Log in with a Nostr pubkey. */ function logInNostr(pubkey: string) { @@ -19,10 +18,7 @@ function nostrExtensionLogIn() { if (!window.nostr) { throw new Error('No Nostr signer available'); } - const pubkey = await window.nostr.getPublicKey(); - - dispatch(closeModal('NOSTR_SIGNIN')); return dispatch(logInNostr(pubkey)); }; } diff --git a/src/features/ui/components/modals/nostr-signin-modal/components/nostr-extension-indicator.tsx b/src/features/ui/components/modals/nostr-signin-modal/components/nostr-extension-indicator.tsx index 63fddbdc1..78dddd33d 100644 --- a/src/features/ui/components/modals/nostr-signin-modal/components/nostr-extension-indicator.tsx +++ b/src/features/ui/components/modals/nostr-signin-modal/components/nostr-extension-indicator.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { FormattedMessage } from 'react-intl'; +import { closeModal } from 'soapbox/actions/modals'; import { nostrExtensionLogIn } from 'soapbox/actions/nostr'; import Stack from 'soapbox/components/ui/stack/stack'; import Text from 'soapbox/components/ui/text/text'; @@ -9,7 +10,10 @@ import { useAppDispatch } from 'soapbox/hooks'; const NostrExtensionIndicator: React.FC = () => { const dispatch = useAppDispatch(); - const onClick = () => dispatch(nostrExtensionLogIn()); + const onClick = () => { + dispatch(nostrExtensionLogIn()); + dispatch(closeModal('NOSTR_SIGNIN')); + }; return ( diff --git a/src/features/ui/components/modals/nostr-signin-modal/steps/extension-step.tsx b/src/features/ui/components/modals/nostr-signin-modal/steps/extension-step.tsx index 7957f3f2c..42bfb4d04 100644 --- a/src/features/ui/components/modals/nostr-signin-modal/steps/extension-step.tsx +++ b/src/features/ui/components/modals/nostr-signin-modal/steps/extension-step.tsx @@ -16,7 +16,11 @@ interface IExtensionStep { const ExtensionStep: React.FC = ({ setStep, onClose }) => { const dispatch = useAppDispatch(); - const onClick = () => dispatch(nostrExtensionLogIn()); + const onClick = () => { + dispatch(nostrExtensionLogIn()); + onClose(); + }; + const onClickAlt = () => setStep('key'); return (