Add fullName to magic link form
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -37,6 +37,7 @@ const sendMagicLinkMutation = graphql`
|
||||
`;
|
||||
|
||||
const schema = z.object({
|
||||
fullName: z.string().min(2),
|
||||
email: z.string().email(),
|
||||
});
|
||||
|
||||
@@ -103,6 +104,7 @@ export function ConnectPage(props: {
|
||||
} = useFormWithSchema(schema, {
|
||||
defaultValues: {
|
||||
email: "",
|
||||
fullName: "",
|
||||
},
|
||||
});
|
||||
|
||||
@@ -110,8 +112,8 @@ export function ConnectPage(props: {
|
||||
sendMagicLinkMutation,
|
||||
);
|
||||
|
||||
const handleSubmit = handleSubmitWrapper(({ email }: FormData) => {
|
||||
const input: SendMagicLinkInput = { email };
|
||||
const handleSubmit = handleSubmitWrapper(({ email, fullName }: FormData) => {
|
||||
const input: SendMagicLinkInput = { email, fullName };
|
||||
if (safeContinueUrl) {
|
||||
input.continue = safeContinueUrl;
|
||||
}
|
||||
@@ -119,6 +121,7 @@ export function ConnectPage(props: {
|
||||
variables: {
|
||||
input: {
|
||||
email,
|
||||
fullName,
|
||||
continue: safeContinueUrl,
|
||||
},
|
||||
},
|
||||
@@ -170,11 +173,20 @@ export function ConnectPage(props: {
|
||||
</div>
|
||||
|
||||
<form onSubmit={e => void handleSubmit(e)} className="space-y-6">
|
||||
<Field
|
||||
label={__("Full Name")}
|
||||
placeholder="John Doe"
|
||||
{...register("fullName")}
|
||||
type="text"
|
||||
required
|
||||
error={formState.errors.fullName?.message}
|
||||
/>
|
||||
<Field
|
||||
label={__("Email")}
|
||||
placeholder="john.doe@acme.com"
|
||||
{...register("email")}
|
||||
type="email"
|
||||
required
|
||||
error={formState.errors.email?.message}
|
||||
/>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* @generated SignedSource<<711ecaa392c23004a3bd1dfb24a5751f>>
|
||||
* @generated SignedSource<<f567da0a977d6ae788cdd5d6eff1d59f>>
|
||||
* @lightSyntaxTransform
|
||||
* @nogrep
|
||||
*/
|
||||
@@ -12,6 +12,7 @@ import { ConcreteRequest } from 'relay-runtime';
|
||||
export type SendMagicLinkInput = {
|
||||
continue?: string | null | undefined;
|
||||
email: any;
|
||||
fullName: string;
|
||||
};
|
||||
export type ConnectPageMutation$variables = {
|
||||
input: SendMagicLinkInput;
|
||||
|
||||
Reference in New Issue
Block a user