diff --git a/src/Components/Facility/ConsultationDetails/index.tsx b/src/Components/Facility/ConsultationDetails/index.tsx index 93b7a039b5a..403f1752704 100644 --- a/src/Components/Facility/ConsultationDetails/index.tsx +++ b/src/Components/Facility/ConsultationDetails/index.tsx @@ -54,10 +54,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); @@ -156,22 +172,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, @@ -422,13 +422,7 @@ export const ConsultationDetails = (props: any) => { 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,