Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug-fix/confirm-passoword-button #776

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/app/screens/createPassword/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function CreatePassword(): JSX.Element {
const [confirmPassword, setConfirmPassword] = useState<string>('');
const [error, setError] = useState<string>('');
const [currentStepIndex, setCurrentStepIndex] = useState<number>(0);
const [isCreatingWallet, setIsCreatingWallet] = useState(false);
const navigate = useNavigate();
const { t } = useTranslation('translation', { keyPrefix: 'CREATE_PASSWORD_SCREEN' });
const { createWallet } = useWalletReducer();
Expand All @@ -56,11 +57,17 @@ function CreatePassword(): JSX.Element {

const handleConfirmPassword = async () => {
if (confirmPassword === password) {
disableWalletExistsGuard?.();
const seedPhrase = await getSeed();
await createWallet(seedPhrase);
await changePassword('', password);
navigate('/wallet-success/create', { replace: true });
try {
setIsCreatingWallet(true);
disableWalletExistsGuard?.();
const seedPhrase = await getSeed();
await createWallet(seedPhrase);
await changePassword('', password);
navigate('/wallet-success/create', { replace: true });
} catch (err) {
setIsCreatingWallet(false);
setError(err as string);
}
} else {
setError(t('CONFIRM_PASSWORD_MATCH_ERROR'));
}
Expand Down Expand Up @@ -104,6 +111,7 @@ function CreatePassword(): JSX.Element {
handleContinue={handleConfirmPassword}
handleBack={handleConfirmPasswordBack}
passwordError={error}
loading={isCreatingWallet}
/>
)}
</PasswordContainer>
Expand Down
Loading