From 734b8acf503681eed90540737796f1087caef627 Mon Sep 17 00:00:00 2001 From: Scott Dickerson Date: Wed, 20 Sep 2023 13:10:13 -0400 Subject: [PATCH] :sparkles: Update Archetype form to work with hub backend (#1379) Moving from the MSW stub for archetypes to the real hub archetype endpoint, the create/update form payload needs to be adjusted. Signed-off-by: Scott J Dickerson --- .../components/archetype-form/archetype-form.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/client/src/app/pages/archetypes/components/archetype-form/archetype-form.tsx b/client/src/app/pages/archetypes/components/archetype-form/archetype-form.tsx index 47e9417431..cf0c5d2e3d 100644 --- a/client/src/app/pages/archetypes/components/archetype-form/archetype-form.tsx +++ b/client/src/app/pages/archetypes/components/archetype-form/archetype-form.tsx @@ -15,6 +15,7 @@ import { import type { Archetype, New, + Ref, Stakeholder, StakeholderGroup, Tag, @@ -174,14 +175,20 @@ export const ArchetypeForm: React.FC = ({ ? undefined : (values.stakeholders .map((name) => stakeholders.find((s) => s.name === name)) - .filter(Boolean) as Stakeholder[]), + .map((sh) => + !sh ? undefined : { id: sh.id, name: sh.name } + ) + .filter(Boolean) as Ref[]), stakeholderGroups: values.stakeholderGroups === undefined ? undefined : (values.stakeholderGroups .map((name) => stakeholderGroups.find((s) => s.name === name)) - .filter(Boolean) as StakeholderGroup[]), + .map((sg) => + !sg ? undefined : { id: sg.id, name: sg.name } + ) + .filter(Boolean) as Ref[]), }; if (archetype && !isDuplicating) { @@ -190,7 +197,7 @@ export const ArchetypeForm: React.FC = ({ createArchetype(payload); } }; - console.log("values", getValues(), getFieldState("criteriaTags"), formState); + return (