Skip to content

Commit

Permalink
Merge branch 'develop' into fix#6134
Browse files Browse the repository at this point in the history
  • Loading branch information
nihal467 authored Sep 26, 2023
2 parents e40b25f + 2973d6e commit 6fb5182
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 34 deletions.
42 changes: 18 additions & 24 deletions src/Components/Facility/ConsultationDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -422,13 +422,7 @@ export const ConsultationDetails = (props: any) => {
<ShowDiagnosis
diagnoses={[
...(consultationData?.diagnosis
? [
{
id: "0",
label: consultationData?.diagnosis,
parentId: null,
},
]
? [{ id: "0", label: consultationData?.diagnosis }]
: []),
...(consultationData?.icd11_diagnoses_object ?? []),
]}
Expand Down
1 change: 0 additions & 1 deletion src/Components/Facility/models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,4 @@ export interface CurrentBed {
export type ICD11DiagnosisModel = {
id: string;
label: string;
parentId: string | null;
};
4 changes: 2 additions & 2 deletions src/Utils/request/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TData> extends RequestOptions<TData> {
controller?: AbortController;
}

Expand All @@ -16,7 +16,7 @@ export default async function request<TData>(
onResponse,
silent,
reattempts = 3,
}: Options = {}
}: Options<TData> = {}
): Promise<RequestResult<TData>> {
const signal = controller?.signal;
const url = makeUrl(path, query, pathParams);
Expand Down
6 changes: 3 additions & 3 deletions src/Utils/request/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ import { QueryRoute, RequestOptions, RequestResult } from "./types";
import request from "./request";
import { mergeRequestOptions } from "./utils";

export interface QueryOptions extends RequestOptions {
export interface QueryOptions<TData> extends RequestOptions<TData> {
prefetch?: boolean;
refetchOnWindowFocus?: boolean;
}

export default function useQuery<TData>(
route: QueryRoute<TData>,
options?: QueryOptions
options?: QueryOptions<TData>
) {
const [response, setResponse] = useState<RequestResult<TData>>();
const [loading, setLoading] = useState(false);

const controllerRef = useRef<AbortController>();

const runQuery = useCallback(
async (overrides?: QueryOptions) => {
async (overrides?: QueryOptions<TData>) => {
controllerRef.current?.abort();

const controller = new AbortController();
Expand Down
8 changes: 4 additions & 4 deletions src/Utils/request/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ export function getAuthorizationHeader() {
return null;
}

export function mergeRequestOptions(
options: RequestOptions,
overrides: RequestOptions
): RequestOptions {
export function mergeRequestOptions<TData>(
options: RequestOptions<TData>,
overrides: RequestOptions<TData>
): RequestOptions<TData> {
return {
...options,
...overrides,
Expand Down

0 comments on commit 6fb5182

Please sign in to comment.