Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
fix: undefined care plan behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmeyer committed Jun 29, 2020
1 parent 922d767 commit 279d649
Showing 1 changed file with 28 additions and 31 deletions.
59 changes: 28 additions & 31 deletions src/patients/care-plans/CarePlanTable.tsx
Expand Up @@ -12,37 +12,34 @@ const CarePlanTable = () => {
const { t } = useTranslation()
const { patient } = useSelector((state: RootState) => state.patient)

if (patient.carePlans !== undefined) {
return (
<Table
tableClassName="table table-hover"
getID={(row) => row.id}
data={patient.carePlans}
columns={[
{ label: t('patient.carePlan.title'), key: 'title' },
{
label: t('patient.carePlan.startDate'),
key: 'startDate',
formatter: (row) => format(new Date(row.startDate), 'yyyy-MM-dd'),
},
{
label: t('patient.carePlan.endDate'),
key: 'endDate',
formatter: (row) => format(new Date(row.endDate), 'yyyy-MM-dd'),
},
{ label: t('patient.carePlan.status'), key: 'status' },
]}
actionsHeaderText={t('actions.label')}
actions={[
{
label: 'actions.view',
action: (row) => history.push(`/patients/${patient.id}/care-plans/${row.id}`),
},
]}
/>
)
}
return <></>
return (
<Table
tableClassName="table table-hover"
getID={(row) => row.id}
data={patient.carePlans || []}
columns={[
{ label: t('patient.carePlan.title'), key: 'title' },
{
label: t('patient.carePlan.startDate'),
key: 'startDate',
formatter: (row) => format(new Date(row.startDate), 'yyyy-MM-dd'),
},
{
label: t('patient.carePlan.endDate'),
key: 'endDate',
formatter: (row) => format(new Date(row.endDate), 'yyyy-MM-dd'),
},
{ label: t('patient.carePlan.status'), key: 'status' },
]}
actionsHeaderText={t('actions.label')}
actions={[
{
label: 'actions.view',
action: (row) => history.push(`/patients/${patient.id}/care-plans/${row.id}`),
},
]}
/>
)
}

export default CarePlanTable

0 comments on commit 279d649

Please sign in to comment.