@ampath/esm-reports-app 1.0.0-next.97 → 1.0.0-next.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,6 +18,13 @@ interface Moh505Response {
18
18
  result: Array<Record<string, unknown>>;
19
19
  }
20
20
 
21
+ /**
22
+ * The ETL server validates the OpenMRS session cookie (JSESSIONID), so every
23
+ * request must carry it. `credentials: 'include'` keeps same-origin proxies
24
+ * working and is required when the ETL base URL is another origin.
25
+ */
26
+ const WITH_SESSION_COOKIE = { credentials: 'include' as RequestCredentials };
27
+
21
28
  export async function getMoh505(params: Moh505Params): Promise<Array<Record<string, unknown>>> {
22
29
  const url = await buildEtlUrl('moh-505', {
23
30
  locationUuids: params.locationUuids || '',
@@ -25,7 +32,7 @@ export async function getMoh505(params: Moh505Params): Promise<Array<Record<stri
25
32
  endDate: params.endDate || '',
26
33
  });
27
34
  try {
28
- const response = await openmrsFetch(url);
35
+ const response = await openmrsFetch(url, WITH_SESSION_COOKIE);
29
36
 
30
37
  if (!response.ok) {
31
38
  const errorText = await response.text();
@@ -53,7 +60,7 @@ export async function getMoh505PatientList(params: PatientListParams): Promise<P
53
60
  ...pageParams(params),
54
61
  });
55
62
  try {
56
- const response = await openmrsFetch(url);
63
+ const response = await openmrsFetch(url, WITH_SESSION_COOKIE);
57
64
 
58
65
  if (!response.ok) {
59
66
  const errorText = await response.text();