Skip to content

Commit

Permalink
Validate username in onClick
Browse files Browse the repository at this point in the history
  • Loading branch information
broody committed Jun 13, 2024
1 parent 44d5ccd commit 7712cb5
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/keychain/src/components/connect/Signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,21 +141,25 @@ function Form({
autoFocus
placeholder="Username"
touched={meta.touched}
error={meta.error}
error={meta.error || error?.message}
onClear={() => form.setFieldValue(field.name, "")}
isLoading={isValidating}
/>
)}
</FormikField>

<ErrorComp error={error} />
</Content>

<Footer isSlot={isSlot} createSession showTerm>
<Button
colorScheme="colorful"
isLoading={isRegistering}
onClick={() => {
onClick={async () => {
const error = await validateUsernameFor("signup")(values.username);
if (error) {
setError(new Error(error));
return;
}

setIsRegistering(true);

const searchParams = new URLSearchParams(window.location.search);
Expand Down

0 comments on commit 7712cb5

Please sign in to comment.