Skip to content

Commit

Permalink
Add transformQueryToApi
Browse files Browse the repository at this point in the history
  • Loading branch information
Kadrian committed Apr 16, 2024
1 parent 5e18a25 commit fc6800f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ const DisclosureField = ({
? { ...f, name: `${field.name}[${index}].${f.name}` }
: f;

console.log(childField.name);

return <Field key={key} field={childField} {...commonProps} />;
})}
</div>
Expand All @@ -108,6 +106,7 @@ export const DisclosureListField = ({
}) => {
const { fields, append, remove } = useFieldArray({
control: commonProps.control,
// @ts-expect-error TODO: figure out how to deal with a dynamic name
name: field.name,
});
console.log(field, defaultValue);
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/js/external-forms/transformQueryToApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,15 @@ function transformFieldToApiEntries(
},
],
];
case "DISCLOSURE_LIST":
return [
[
rawFieldname,
(formValue as DynamicFormValues[]).map((v) =>
transformFieldsToApi(fieldConfig.fields, v),
),
],
];
}
}

Expand Down

0 comments on commit fc6800f

Please sign in to comment.