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

Fix user login #2987

Closed
wants to merge 16 commits into from
Closed
Prev Previous commit
Next Next commit
run lint fix
added "lodash": "4.14.182" to dependencies in package.json
  • Loading branch information
xhefribala committed Sep 13, 2022
commit b9a919ca5fd27c9c58b5331ea6c7e3f7cfd0e720
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"json2csv": "~5.0.1",
"node-sass": "~7.0.0",
"pouchdb": "~7.2.1",
"lodash": "4.14.182",
"pouchdb-adapter-memory": "~7.2.1",
"pouchdb-authentication": "~1.1.3",
"pouchdb-find": "~7.2.1",
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/incidents/hooks/useReportIncident.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('useReportIncident', () => {
description: 'some description',
reportedBy: 'some user',
reportByUserID: 'some id',
} as Incident
} as Incident

const expectedIncident = {
...givenIncidentRequest,
Expand Down
2 changes: 1 addition & 1 deletion src/incidents/hooks/useReportIncident.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ export default function useReportIncident() {
},
throwOnError: true,
})
}
}
14 changes: 7 additions & 7 deletions src/incidents/report/ReportIncident.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Button, Row, Column, Typeahead, Label } from '@hospitalrun/components'
import React, { useState, useEffect } from 'react'
import { useSelector } from 'react-redux'
import { useHistory } from 'react-router-dom'

import useAddBreadcrumbs from '../../page-header/breadcrumbs/useAddBreadcrumbs'
Expand All @@ -11,38 +12,37 @@ import PatientRepository from '../../shared/db/PatientRepository'
import useTranslator from '../../shared/hooks/useTranslator'
import Incident from '../../shared/model/Incident'
import Patient from '../../shared/model/Patient'
import { RootState } from '../../shared/store'
import useReportIncident from '../hooks/useReportIncident'
import { IncidentError } from '../util/validate-incident'
import {useSelector } from 'react-redux'
import { RootState } from '../../shared/store'

const ReportIncident = () => {
const [mutate] = useReportIncident()
const history = useHistory()
const { t } = useTranslator()
const updateTitle = useUpdateTitle()
const {user} = useSelector((state: RootState) => state.user)
const { user } = useSelector((state: RootState) => state.user)

useEffect(() => {
updateTitle(t('incidents.reports.new'))
})
const breadcrumbs = [
{
i18nKey: 'incidents.reports.new',
i18nKey: 'incidents.reports.new',
location: `/incidents/new`,
},
]
useAddBreadcrumbs(breadcrumbs)
const [incident, setIncident] = useState({
reportedBy: user?.fullName, //user is read from redux store state.user and the fullName is used while showing details
reportedBy: user?.fullName, // user is read from redux store state.user and the fullName is used while showing details
reportByUserID: user?.id,
date: new Date().toISOString(),
department: '',
category: '',
categoryItem: '',
description: '',
patient: '',
})
})

const [error, setError] = useState<IncidentError | undefined>(undefined)

Expand Down Expand Up @@ -185,4 +185,4 @@ const ReportIncident = () => {
)
}

export default ReportIncident
export default ReportIncident