refresh
This commit is contained in:
@@ -20,15 +20,38 @@ export function VerifyEmailDialog({
|
|||||||
}: {
|
}: {
|
||||||
control: Dialog.DialogControlProps
|
control: Dialog.DialogControlProps
|
||||||
}) {
|
}) {
|
||||||
|
const agent = useAgent()
|
||||||
|
|
||||||
|
const [didVerify, setDidVerify] = React.useState(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog.Outer control={control}>
|
<Dialog.Outer
|
||||||
|
control={control}
|
||||||
|
onClose={async () => {
|
||||||
|
if (!didVerify) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await agent.resumeSession(agent.session!)
|
||||||
|
} catch (e: unknown) {
|
||||||
|
logger.error(String(e))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}}>
|
||||||
<Dialog.Handle />
|
<Dialog.Handle />
|
||||||
<Inner control={control} />
|
<Inner control={control} setDidVerify={setDidVerify} />
|
||||||
</Dialog.Outer>
|
</Dialog.Outer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Inner({control}: {control: Dialog.DialogControlProps}) {
|
export function Inner({
|
||||||
|
control,
|
||||||
|
setDidVerify,
|
||||||
|
}: {
|
||||||
|
control: Dialog.DialogControlProps
|
||||||
|
setDidVerify: (value: boolean) => void
|
||||||
|
}) {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
const {currentAccount} = useSession()
|
const {currentAccount} = useSession()
|
||||||
const agent = useAgent()
|
const agent = useAgent()
|
||||||
@@ -87,16 +110,8 @@ export function Inner({control}: {control: Dialog.DialogControlProps}) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
await agent.resumeSession(agent.session!)
|
|
||||||
} catch (e: unknown) {
|
|
||||||
setError(cleanError(String(e)))
|
|
||||||
setIsProcessing(false)
|
|
||||||
logger.error(String(e))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
setIsProcessing(false)
|
setIsProcessing(false)
|
||||||
|
setDidVerify(true)
|
||||||
setCurrentStep('StepThree')
|
setCurrentStep('StepThree')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,6 +209,9 @@ export function Inner({control}: {control: Dialog.DialogControlProps}) {
|
|||||||
<ButtonText>
|
<ButtonText>
|
||||||
<Trans>Confirm</Trans>
|
<Trans>Confirm</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
|
{isProcessing ? (
|
||||||
|
<Loader size="sm" style={[{color: 'white'}]} />
|
||||||
|
) : null}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
label={_(msg`Resend Email`)}
|
label={_(msg`Resend Email`)}
|
||||||
@@ -208,9 +226,6 @@ export function Inner({control}: {control: Dialog.DialogControlProps}) {
|
|||||||
<ButtonText>
|
<ButtonText>
|
||||||
<Trans>Resend Email</Trans>
|
<Trans>Resend Email</Trans>
|
||||||
</ButtonText>
|
</ButtonText>
|
||||||
{isProcessing ? (
|
|
||||||
<Loader size="sm" style={[{color: 'white'}]} />
|
|
||||||
) : null}
|
|
||||||
</Button>
|
</Button>
|
||||||
</>
|
</>
|
||||||
) : currentStep === 'StepThree' ? (
|
) : currentStep === 'StepThree' ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user