From 72791a14e582c3aa89b716769e0f6781a3ec445d Mon Sep 17 00:00:00 2001 From: VHAISPBARRSS <2481110+stephenBarrs@users.noreply.github.com> Date: Thu, 13 Feb 2025 17:29:06 -0500 Subject: [PATCH] add labTypes parameter to Labs and Tests API and query hook --- .../src/api/labsAndTests/getLabsAndTests.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/VAMobile/src/api/labsAndTests/getLabsAndTests.tsx b/VAMobile/src/api/labsAndTests/getLabsAndTests.tsx index 4121bb6e706..6a73e9c80ee 100644 --- a/VAMobile/src/api/labsAndTests/getLabsAndTests.tsx +++ b/VAMobile/src/api/labsAndTests/getLabsAndTests.tsx @@ -13,16 +13,24 @@ export type LabsAndTestQuery = { } page?: string timeFrame?: string + labTypes?: string[] } +const defaultLabTypes = ['SP'] + /** * Fetch user Labs and Tests */ -const getLabsAndTests = ({ dateRange, page = '1' }: LabsAndTestQuery): Promise => { +const getLabsAndTests = ({ + dateRange, + page = '1', + labTypes = defaultLabTypes, +}: LabsAndTestQuery): Promise => { return get(`/v0/health/labs-and-tests`, { startDate: dateRange.start, endDate: dateRange.end, page, + labTypes, useCache: 'false', }) } @@ -30,10 +38,13 @@ const getLabsAndTests = ({ dateRange, page = '1' }: LabsAndTestQuery): Promise { +export const useLabsAndTests = ( + { dateRange, timeFrame, labTypes }: LabsAndTestQuery, + options?: { enabled?: boolean }, +) => { return useQuery({ ...options, - queryKey: [labsAndTestsKeys.labsAndTests, timeFrame], + queryKey: [labsAndTestsKeys.labsAndTests, timeFrame, labTypes], queryFn: () => getLabsAndTests({ dateRange }), meta: { errorName: 'getLabsAndTests: Service error',