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

Commit

Permalink
feat(viewlabs): sort Labs by requestedOn field
Browse files Browse the repository at this point in the history
fix #1966
  • Loading branch information
akshay-ap committed Apr 21, 2020
1 parent c703928 commit d026ae7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/labs/ViewLabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useButtonToolbarSetter } from 'page-header/ButtonBarProvider'
import { Button } from '@hospitalrun/components'
import { useHistory } from 'react-router'
import LabRepository from 'clients/db/LabRepository'
import SortRequest from 'clients/db/SortRequest'
import Lab from 'model/Lab'
import { useSelector } from 'react-redux'
import Permissions from 'model/Permissions'
Expand Down Expand Up @@ -38,7 +39,15 @@ const ViewLabs = () => {

useEffect(() => {
const fetch = async () => {
const fetchedLabs = await LabRepository.findAll()
const sortRequest: SortRequest = {
sorts: [
{
field: 'requestedOn',
direction: 'desc',
},
],
}
const fetchedLabs = await LabRepository.findAll(sortRequest)
setLabs(fetchedLabs)
}

Expand Down

0 comments on commit d026ae7

Please sign in to comment.