From 9fb1a9fb8a5b19d4947cb145aaede6a44315e02d Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Mon, 25 Sep 2023 19:56:34 +0530 Subject: [PATCH 1/2] request: fix/improve typesafety of `TData` (#6324) --- src/Utils/request/request.ts | 4 ++-- src/Utils/request/useQuery.ts | 6 +++--- src/Utils/request/utils.ts | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Utils/request/request.ts b/src/Utils/request/request.ts index 45c8e5ce664..c946f524ab9 100644 --- a/src/Utils/request/request.ts +++ b/src/Utils/request/request.ts @@ -2,7 +2,7 @@ import handleResponse from "./handleResponse"; import { RequestOptions, RequestResult, Route } from "./types"; import { makeHeaders, makeUrl } from "./utils"; -interface Options extends RequestOptions { +interface Options extends RequestOptions { controller?: AbortController; } @@ -16,7 +16,7 @@ export default async function request( onResponse, silent, reattempts = 3, - }: Options = {} + }: Options = {} ): Promise> { const signal = controller?.signal; const url = makeUrl(path, query, pathParams); diff --git a/src/Utils/request/useQuery.ts b/src/Utils/request/useQuery.ts index a370b909fe9..2a8cb2e2ad4 100644 --- a/src/Utils/request/useQuery.ts +++ b/src/Utils/request/useQuery.ts @@ -3,14 +3,14 @@ import { QueryRoute, RequestOptions, RequestResult } from "./types"; import request from "./request"; import { mergeRequestOptions } from "./utils"; -export interface QueryOptions extends RequestOptions { +export interface QueryOptions extends RequestOptions { prefetch?: boolean; refetchOnWindowFocus?: boolean; } export default function useQuery( route: QueryRoute, - options?: QueryOptions + options?: QueryOptions ) { const [response, setResponse] = useState>(); const [loading, setLoading] = useState(false); @@ -18,7 +18,7 @@ export default function useQuery( const controllerRef = useRef(); const runQuery = useCallback( - async (overrides?: QueryOptions) => { + async (overrides?: QueryOptions) => { controllerRef.current?.abort(); const controller = new AbortController(); diff --git a/src/Utils/request/utils.ts b/src/Utils/request/utils.ts index 5a4fb7e2b2e..f159df1b7a7 100644 --- a/src/Utils/request/utils.ts +++ b/src/Utils/request/utils.ts @@ -69,10 +69,10 @@ export function getAuthorizationHeader() { return null; } -export function mergeRequestOptions( - options: RequestOptions, - overrides: RequestOptions -): RequestOptions { +export function mergeRequestOptions( + options: RequestOptions, + overrides: RequestOptions +): RequestOptions { return { ...options, ...overrides, From 2973d6e08d520a49b411851722c4e56a2c8abae2 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Mon, 25 Sep 2023 19:57:10 +0530 Subject: [PATCH 2/2] update icd11 model (#6343) --- .../Facility/ConsultationDetails/index.tsx | 42 ++++++++----------- src/Components/Facility/models.tsx | 1 - 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/Components/Facility/ConsultationDetails/index.tsx b/src/Components/Facility/ConsultationDetails/index.tsx index 356257f9ac6..c23bf071fa1 100644 --- a/src/Components/Facility/ConsultationDetails/index.tsx +++ b/src/Components/Facility/ConsultationDetails/index.tsx @@ -50,10 +50,26 @@ export interface ConsultationTabProps { patientData: PatientModel; } +const TABS = { + UPDATES: ConsultationUpdatesTab, + FEED: ConsultationFeedTab, + SUMMARY: ConsultationSummaryTab, + MEDICINES: ConsultationMedicinesTab, + FILES: ConsultationFilesTab, + INVESTIGATIONS: ConsultationInvestigationsTab, + ABG: ConsultationABGTab, + NURSING: ConsultationNursingTab, + NEUROLOGICAL_MONITORING: ConsultationNeurologicalMonitoringTab, + VENTILATOR: ConsultationVentilatorTab, + NUTRITION: ConsultationNursingTab, + PRESSURE_SORE: ConsultationPressureSoreTab, + DIALYSIS: ConsultationDialysisTab, +}; + export const ConsultationDetails = (props: any) => { const { t } = useTranslation(); const { facilityId, patientId, consultationId } = props; - const tab = props.tab.toUpperCase(); + const tab = props.tab.toUpperCase() as keyof typeof TABS; const dispatch: any = useDispatch(); const [isLoading, setIsLoading] = useState(false); const [showDoctors, setShowDoctors] = useState(false); @@ -142,22 +158,6 @@ export const ConsultationDetails = (props: any) => { }); }, []); - const TABS = { - UPDATES: ConsultationUpdatesTab, - FEED: ConsultationFeedTab, - SUMMARY: ConsultationSummaryTab, - MEDICINES: ConsultationMedicinesTab, - FILES: ConsultationFilesTab, - INVESTIGATIONS: ConsultationInvestigationsTab, - ABG: ConsultationABGTab, - NURSING: ConsultationNursingTab, - NEUROLOGICAL_MONITORING: ConsultationNeurologicalMonitoringTab, - VENTILATOR: ConsultationVentilatorTab, - NUTRITION: ConsultationNursingTab, - PRESSURE_SORE: ConsultationPressureSoreTab, - DIALYSIS: ConsultationDialysisTab, - }; - const consultationTabProps: ConsultationTabProps = { consultationId, facilityId, @@ -379,13 +379,7 @@ export const ConsultationDetails = (props: any) => {