Skip to content

Commit

Permalink
(refactor) Pass form mode as additional props as opposed to string (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
CynthiaKamau authored Mar 6, 2024
1 parent d708622 commit ec44be8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { InlineLoading } from '@carbon/react';
import { OHRIForm, type SessionMode } from '@openmrs/openmrs-form-engine-lib';
import { OHRIForm } from '@openmrs/openmrs-form-engine-lib';
import { type Visit } from '@openmrs/esm-framework';
import useFormSchema from '../hooks/useFormSchema';
import FormError from './form-error.component';
Expand All @@ -13,7 +13,7 @@ interface FormRendererProps extends DefaultWorkspaceProps {
patientUuid: string;
visit?: Visit;
encounterUuid?: string;
mode?: SessionMode;
additionalProps?: Record<string, any>;
}

const FormRenderer: React.FC<FormRendererProps> = ({
Expand All @@ -23,7 +23,7 @@ const FormRenderer: React.FC<FormRendererProps> = ({
closeWorkspace,
closeWorkspaceWithSavedChanges,
encounterUuid,
mode,
additionalProps,
}) => {
const { t } = useTranslation();
const { schema, error, isLoading } = useFormSchema(formUuid);
Expand Down Expand Up @@ -54,7 +54,7 @@ const FormRenderer: React.FC<FormRendererProps> = ({
formJson={schema}
handleClose={closeWorkspace}
onSubmit={closeWorkspaceWithSavedChanges}
mode={mode}
mode={additionalProps?.mode}
/>
)}
</>
Expand Down

0 comments on commit ec44be8

Please # to comment.