Skip to content

Commit

Permalink
fill out fhir authorization
Browse files Browse the repository at this point in the history
  • Loading branch information
KeeyanGhoreshi committed Nov 8, 2023
1 parent 291e30e commit e1b9c1b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ REACT_APP_PHARMACY_SERVER_BASE = http://localhost:5051
REACT_APP_ETASU_STATUS_ENABLED = true
REACT_APP_PHARMACY_STATUS_ENABLED = true
REACT_APP_SEND_RX_ENABLED = true
REACT_APP_SEND_FHIR_AUTH_ENABLED = false
PORT=4040
REACT_APP_CLIENT_ID = app-login
REACT_APP_CLIENT_SCOPES = launch openid profile user/Patient.read patient/Patient.read user/Practitioner.read
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Following are a list of modifiable paths:
| REACT_APP_PHARMACY_STATUS_ENABLED | `true` |
| REACT_APP_DEVELOPER_MODE | `true` |
| REACT_APP_SEND_RX_ENABLED | `true` |
| REACT_APP_SEND_FHIR_AUTH_ENABLED | `true` |
| PORT | `4040`|

*Note that .env values can only be accessed by react app starting with `REACT_APP_`*
Expand Down
12 changes: 9 additions & 3 deletions src/views/Patient/MedReqDropDown/MedReqDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Client from 'fhirclient/lib/Client';
import { ReactElement, useEffect, useState } from 'react';
import example from '../../../cds-hooks/prefetch/exampleHookService.json'; // TODO: Replace with request to CDS service
import { hydrate } from '../../../cds-hooks/prefetch/PrefetchHydrator';
import { Hook, Card as HooksCard } from '../../../cds-hooks/resources/HookTypes';
import { Hook, Card as HooksCard, OrderSelectHook } from '../../../cds-hooks/resources/HookTypes';
import OrderSelect from '../../../cds-hooks/resources/OrderSelect';
import './MedReqDropDown.css';
import * as env from 'env-var';
Expand Down Expand Up @@ -203,8 +203,14 @@ function MedReqDropDown(props: MedReqDropDownProps) {
},
[resourceId]
);
const tempHook = hook.generate();

let tempHook: OrderSelectHook;
if(env.get('REACT_APP_SEND_FHIR_AUTH_ENABLED').asBool()){
tempHook = hook.generate(client);
} else {
tempHook = hook.generate();
}
console.log(env.get('REACT_APP_SEND_FHIR_AUTH_ENABLED').asBool());
console.log(tempHook);
hydrate(getFhirResource, example.prefetch, tempHook).then(() => {
setCDSHook(tempHook);
});
Expand Down

0 comments on commit e1b9c1b

Please sign in to comment.