forked from harness/canary
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cb1e9f
commit 0eb2ed5
Showing
11 changed files
with
16,830 additions
and
10,411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,14 +23,14 @@ import { AnimatedHarnessLogo } from './components/animated-harness-logo' | |
|
||
const OTP_LENGTH = 4 | ||
|
||
interface PageProps { | ||
interface OTPPageProps { | ||
handleResend?: () => void | ||
isLoading?: boolean | ||
handleFormSubmit?: (data: OtpPageDataProps) => void | ||
handleFormSubmit?: (data: OtpPageData) => void | ||
error?: string | ||
} | ||
|
||
export interface OtpPageDataProps { | ||
export interface OtpPageData { | ||
email?: string | ||
otp: string | ||
} | ||
|
@@ -42,7 +42,7 @@ const otpPasswordSchema = z.object({ | |
.regex(/^\d+$/, { message: 'Code must contain only numbers' }) | ||
}) | ||
|
||
export function OTPPage({ handleResend, isLoading, handleFormSubmit, error }: PageProps) { | ||
export function OTPPage({ handleResend, isLoading, handleFormSubmit, error }: OTPPageProps) { | ||
const [serverError, setServerError] = useState<string | null>(null) | ||
// TODO: get email from url or from context | ||
const email = '[email protected]' | ||
|
@@ -53,7 +53,7 @@ export function OTPPage({ handleResend, isLoading, handleFormSubmit, error }: Pa | |
formState: { errors }, | ||
reset, | ||
watch | ||
} = useForm<OtpPageDataProps>({ | ||
} = useForm<OtpPageData>({ | ||
mode: 'onSubmit', | ||
resolver: zodResolver(otpPasswordSchema), | ||
defaultValues: { | ||
|
@@ -62,7 +62,7 @@ export function OTPPage({ handleResend, isLoading, handleFormSubmit, error }: Pa | |
}) | ||
const otpValue = watch('otp') | ||
|
||
const onSubmit = (data: OtpPageDataProps) => { | ||
const onSubmit = (data: OtpPageData) => { | ||
setServerError(null) | ||
handleFormSubmit?.({ ...data, email }) | ||
reset() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.