Skip to content

Commit

Permalink
(fix) Fix restBaseUrl (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen authored Feb 29, 2024
1 parent 1ff7221 commit 6823de3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type encounterRequest = {
};

export function useGetDataEntryStatistics(params: encounterRequest) {
const apiUrl = `${restBaseUrl}dataentrystatistics?fromDate=${params.fromDate}&toDate=${params.toDate}&encUserColumn=${params.encUserColumn}&groupBy=${params.groupBy}`;
const apiUrl = `${restBaseUrl}/dataentrystatistics?fromDate=${params.fromDate}&toDate=${params.toDate}&encUserColumn=${params.encUserColumn}&groupBy=${params.groupBy}`;
const abortController = new AbortController();

const { mutate } = useSWRConfig();
Expand All @@ -35,7 +35,7 @@ export function useGetDataEntryStatistics(params: encounterRequest) {
}

export async function getDataEntryStatistics(params: encounterRequest) {
const apiUrl = `${restBaseUrl}dataentrystatistics?fromDate=${params.fromDate}&toDate=${params.toDate}&encUserColumn=${params.encUserColumn}&groupBy=${params.groupBy}`;
const apiUrl = `${restBaseUrl}/dataentrystatistics?fromDate=${params.fromDate}&toDate=${params.toDate}&encUserColumn=${params.encUserColumn}&groupBy=${params.groupBy}`;
const abortController = new AbortController();

return openmrsFetch(apiUrl, {
Expand Down
8 changes: 4 additions & 4 deletions src/facility-metrics/facility-metrics.resource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export async function fetchTransactionCount(
const abortController = new AbortController();
const apiURL =
type === "fhirProfile"
? `${restBaseUrl}syncfhirresourcestats?profile`
: `${restBaseUrl}synctaskstats?type`;
? `${restBaseUrl}/syncfhirresourcestats?profile`
: `${restBaseUrl}/synctaskstats?type`;

const response = await openmrsFetch(
`${apiURL}=${uuid}&startDate=${startDate}&endDate=${endDate}`,
Expand All @@ -79,8 +79,8 @@ export async function fetchTransactions(
const abortController = new AbortController();
const apiURL =
type === "fhirProfile"
? `${restBaseUrl}syncfhirresourcedetails?profile`
: `${restBaseUrl}synctaskdetails?synctasktype`;
? `${restBaseUrl}/syncfhirresourcedetails?profile`
: `${restBaseUrl}/synctaskdetails?synctasktype`;

return await openmrsFetch(
`${apiURL}=${uuid}&startDate=${startDate}&endDate=${endDate}`,
Expand Down
2 changes: 1 addition & 1 deletion src/facility-metrics/performance/performance.resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import useSWR from "swr";
import { openmrsFetch, restBaseUrl } from "@openmrs/esm-framework";

export function useGetFacilityMetrics() {
const apiURL = `${restBaseUrl}ugandaemrreports/genderMetrics`;
const apiURL = `${restBaseUrl}/ugandaemrreports/genderMetrics`;

const { data, error, isLoading } = useSWR<{ data: { results: any } }, Error>(
apiURL,
Expand Down
2 changes: 1 addition & 1 deletion src/fhir/fhir.resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { openmrsFetch, restBaseUrl } from "@openmrs/esm-framework";
import { EditAction } from "./fhir.component";

export function useGetFhirProfiles() {
const apiUrl = `${restBaseUrl}syncfhirprofile`;
const apiUrl = `${restBaseUrl}/syncfhirprofile`;
const { data, error, isLoading } = useSWR<{ data: { results: any } }, Error>(
apiUrl,
openmrsFetch
Expand Down

0 comments on commit 6823de3

Please sign in to comment.