fix: use iframe for nsecbunker auth
All checks were successful
Release / build_and_release (push) Successful in 43s

This commit is contained in:
Sabir Hassan 2024-03-19 10:46:27 +05:00
parent 7c3c061b88
commit c99a2a81c2

View File

@ -31,6 +31,7 @@ export const Login = () => {
const [isLoading, setIsLoading] = useState(false) const [isLoading, setIsLoading] = useState(false)
const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('') const [loadingSpinnerDesc, setLoadingSpinnerDesc] = useState('')
const [inputValue, setInputValue] = useState('') const [inputValue, setInputValue] = useState('')
const [authUrl, setAuthUrl] = useState<string>()
const [isNostrExtensionAvailable, setIsNostrExtensionAvailable] = const [isNostrExtensionAvailable, setIsNostrExtensionAvailable] =
useState(false) useState(false)
@ -175,7 +176,11 @@ export const Login = () => {
setLoadingSpinnerDesc('Creating nsecbunker singer') setLoadingSpinnerDesc('Creating nsecbunker singer')
await nostrController await nostrController
.createNsecBunkerSigner(pubkey) .createNsecBunkerSigner(pubkey)
.then(async () => { .then(async (signer) => {
signer.on('authUrl', (url: string) => {
setAuthUrl(url)
})
dispatch(updateLoginMethod(LoginMethods.nsecBunker)) dispatch(updateLoginMethod(LoginMethods.nsecBunker))
dispatch(updateNsecbunkerPubkey(pubkey)) dispatch(updateNsecbunkerPubkey(pubkey))
@ -216,6 +221,17 @@ export const Login = () => {
return return
} }
if (authUrl) {
return (
<iframe
title='Nsecbunker auth'
src={authUrl}
width='100%'
height='500px'
/>
)
}
return ( return (
<> <>
{isLoading && <LoadingSpinner desc={loadingSpinnerDesc} />} {isLoading && <LoadingSpinner desc={loadingSpinnerDesc} />}