@@ -124,10 +124,8 @@ export function PersonForm(props: {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
const handleSubmit = handleSubmitWrapper(async (data: z.infer<typeof schema>) => {
|
const handleSubmit = handleSubmitWrapper(async (data: z.infer<typeof schema>) => {
|
||||||
const input = {
|
const sharedInput = {
|
||||||
fullName: data.fullName,
|
fullName: data.fullName,
|
||||||
emailAddress: data.emailAddress,
|
|
||||||
role: data.role,
|
|
||||||
additionalEmailAddresses: data.additionalEmailAddresses,
|
additionalEmailAddresses: data.additionalEmailAddresses,
|
||||||
kind: data.kind,
|
kind: data.kind,
|
||||||
position: data.position,
|
position: data.position,
|
||||||
@@ -137,7 +135,7 @@ export function PersonForm(props: {
|
|||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
await updatePerson({
|
await updatePerson({
|
||||||
variables: { input: { ...input, id } },
|
variables: { input: { ...sharedInput, id } },
|
||||||
onCompleted: () => {
|
onCompleted: () => {
|
||||||
reset(data);
|
reset(data);
|
||||||
onSubmit?.();
|
onSubmit?.();
|
||||||
@@ -146,7 +144,12 @@ export function PersonForm(props: {
|
|||||||
} else {
|
} else {
|
||||||
await createPerson({
|
await createPerson({
|
||||||
variables: {
|
variables: {
|
||||||
input: { ...input, organizationId },
|
input: {
|
||||||
|
...sharedInput,
|
||||||
|
emailAddress: data.emailAddress,
|
||||||
|
role: data.role,
|
||||||
|
organizationId,
|
||||||
|
},
|
||||||
connections: [connectionId],
|
connections: [connectionId],
|
||||||
},
|
},
|
||||||
onCompleted: () => {
|
onCompleted: () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user