Merge pull request #69 from nostrband/develop

Fix redirect to confirm connect w/ popup=true after login
This commit is contained in:
Nostr.Band 2024-02-15 09:00:24 +03:00 committed by GitHub
commit 40f4a9922a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,6 +31,8 @@ export const ModalLogin = () => {
const navigate = useNavigate()
const { hidePassword, inputProps } = usePassword()
const [isLoading, setIsLoading] = useState(false)
const [searchParams] = useSearchParams()
const isPopup = searchParams.get('popup') === 'true'
const {
handleSubmit,
@ -81,7 +83,7 @@ export const ModalLogin = () => {
cleanUpStates()
setTimeout(() => {
// give frontend time to read the new key first
navigate(`/key/${k.npub}`)
navigate(`/key/${k.npub}${isPopup ? '?popup=true' : ''}`)
}, 300)
} catch (error: any) {
console.log('error', error)
@ -90,10 +92,8 @@ export const ModalLogin = () => {
}
}
const [searchParams] = useSearchParams()
useEffect(() => {
if (isModalOpened) {
const isPopup = searchParams.get('popup') === 'true'
const npub = searchParams.get('npub') || ''
const appNpub = searchParams.get('appNpub') || ''
if (isPopup && isModalOpened) {