Reset people form on submit
Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
@@ -30,7 +30,7 @@ const schema = z.object({
|
|||||||
additionalEmailAddresses: z.preprocess(
|
additionalEmailAddresses: z.preprocess(
|
||||||
// Empty additional emails are skipped
|
// Empty additional emails are skipped
|
||||||
(v) => (v as string[]).filter((v) => !!v),
|
(v) => (v as string[]).filter((v) => !!v),
|
||||||
z.array(z.string().email())
|
z.array(z.string().email()),
|
||||||
),
|
),
|
||||||
kind: z.enum(peopleRoles),
|
kind: z.enum(peopleRoles),
|
||||||
});
|
});
|
||||||
@@ -57,7 +57,7 @@ export const createPeopleMutation = graphql`
|
|||||||
export function CreatePeopleDialog({ children, connectionId }: Props) {
|
export function CreatePeopleDialog({ children, connectionId }: Props) {
|
||||||
const { __ } = useTranslate();
|
const { __ } = useTranslate();
|
||||||
const organizationId = useOrganizationId();
|
const organizationId = useOrganizationId();
|
||||||
const { control, handleSubmit, register } = useFormWithSchema(schema, {
|
const { control, handleSubmit, register, reset } = useFormWithSchema(schema, {
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
additionalEmailAddresses: [],
|
additionalEmailAddresses: [],
|
||||||
},
|
},
|
||||||
@@ -79,6 +79,7 @@ export function CreatePeopleDialog({ children, connectionId }: Props) {
|
|||||||
connections: [connectionId],
|
connections: [connectionId],
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
|
reset();
|
||||||
ref.current?.close();
|
ref.current?.close();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user