From 6855f15ff49478276748295292d4ddbc282afa3e Mon Sep 17 00:00:00 2001 From: ibolton336 Date: Thu, 12 Oct 2023 10:05:39 -0400 Subject: [PATCH] :bug: Save and review for archetypes Signed-off-by: ibolton336 --- .../assessment-wizard/assessment-wizard.tsx | 35 +++++++++---------- .../custom-wizard-footer.tsx | 20 +++++------ 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/client/src/app/pages/assessment/components/assessment-wizard/assessment-wizard.tsx b/client/src/app/pages/assessment/components/assessment-wizard/assessment-wizard.tsx index 461b012d56..4f0e0fba70 100644 --- a/client/src/app/pages/assessment/components/assessment-wizard/assessment-wizard.tsx +++ b/client/src/app/pages/assessment/components/assessment-wizard/assessment-wizard.tsx @@ -14,7 +14,7 @@ import { Section, } from "@app/api/models"; import { CustomWizardFooter } from "../custom-wizard-footer"; -import { getApplicationById } from "@app/api/rest"; +import { getApplicationById, getArchetypeById } from "@app/api/rest"; import { NotificationsContext } from "@app/components/NotificationsContext"; import { WizardStepNavDescription } from "../wizard-step-nav-description"; import { QuestionnaireForm } from "../questionnaire-form"; @@ -442,23 +442,21 @@ export const AssessmentWizard: React.FC = ({ variant: "success", }); if (isArchetype) { - //TODO: Review Archetype? - // assessment?.archetype?.id && - // getArchetypeById(assessment.archetype.id) - // .then((data) => { - // history.push( - // formatPath(Paths.a, { - // applicationId: data.id, - // }) - // ); - // }) - // .catch((error) => { - // pushNotification({ - // title: getAxiosErrorMessage(error), - // variant: "danger", - // }); - // }); - // } + assessment?.archetype?.id && + getArchetypeById(assessment.archetype.id) + .then((data) => { + history.push( + formatPath(Paths.archetypeReview, { + archetypeId: data.id, + }) + ); + }) + .catch((error) => { + pushNotification({ + title: getAxiosErrorMessage(error), + variant: "danger", + }); + }); } else { assessment?.application?.id && getApplicationById(assessment.application.id) @@ -538,7 +536,6 @@ export const AssessmentWizard: React.FC = ({ const wizardFooter = ( void; onSaveAsDraft: () => void; @@ -23,7 +22,6 @@ export const CustomWizardFooter: React.FC = ({ isLastStep, isDisabled, isFormInvalid, - isArchetype, hasAnswers, onSave, onSaveAsDraft, @@ -51,16 +49,14 @@ export const CustomWizardFooter: React.FC = ({ > {t("actions.save")} - {!isArchetype && ( - - )} + ) : (