diff --git a/amplify.yml b/amplify.yml index c69e99b..7b11688 100644 --- a/amplify.yml +++ b/amplify.yml @@ -12,6 +12,8 @@ frontend: - npm ci build: commands: + - echo "REACT_APP_EHR_ENDPOINT=$REACT_APP_EHR_ENDPOINT" >> .env + - echo "REACT_APP_EHR_CLIENT_ID=$REACT_APP_EHR_CLIENT_ID" >> .env - npm run build artifacts: baseDirectory: build diff --git a/src/App.js b/src/App.js index cffaddd..fd8ad8f 100644 --- a/src/App.js +++ b/src/App.js @@ -1,7 +1,7 @@ -import Navbar from './Components/navbar'; -import Form from './Pages/form'; -import Upload from './Pages/upload'; -import Admin from './Pages/admin'; +import Navbar from './components/navbar'; +import Form from './pages/form'; +import Upload from './pages/upload'; +import Admin from './pages/admin'; import { Routes, Route } from 'react-router-dom' import { Amplify } from 'aws-amplify'; import { withAuthenticator } from '@aws-amplify/ui-react'; diff --git a/src/Pages/form.js b/src/Pages/form.js index a698994..56f5549 100644 --- a/src/Pages/form.js +++ b/src/Pages/form.js @@ -18,7 +18,7 @@ function Form(props) { const [version, setVersion] = useState(); const [formVersion, setFormVersion] = useState(1); - const baseEndpoint = 'http://localhost:4004/hapi-fhir-jpaserver/fhir/Questionnaire/'; + const baseEndpoint = process.env.REACT_APP_EHR_ENDPOINT + '/Questionnaire/'; useEffect(() => { fetchForms(); @@ -128,7 +128,7 @@ function Form(props) { } async function httpRequest(requestMethod, responseID) { - let qrEndpoint = 'http://localhost:4004/hapi-fhir-jpaserver/fhir/QuestionnaireResponse'; + let qrEndpoint = process.env.REACT_APP_EHR_ENDPOINT + '/QuestionnaireResponse'; let formID = await getFormID() if (requestMethod === 'post') { diff --git a/src/Pages/upload.js b/src/Pages/upload.js index 5899306..5e494b8 100644 --- a/src/Pages/upload.js +++ b/src/Pages/upload.js @@ -24,7 +24,7 @@ export default function Upload(props) { const [availableForms, setAvailableForms] = useState([]); const [selectedForm, setSelectedForm] = useState(''); - const endpoint = 'http://localhost:4004/hapi-fhir-jpaserver/fhir/Questionnaire'; + const endpoint = process.env.REACT_APP_EHR_ENDPOINT + '/Questionnaire'; useEffect(() => { async function existingForms() { diff --git a/src/index.js b/src/index.js index 1499f3d..2ffb6f5 100644 --- a/src/index.js +++ b/src/index.js @@ -7,10 +7,11 @@ import FHIR from 'fhirclient'; import reportWebVitals from './reportWebVitals'; const root = ReactDOM.createRoot(document.getElementById('root')); +const ehrClientID = process.env.REACT_APP_EHR_CLIENT_ID const smartFhirLaunch = () => { FHIR.oauth2.init({ - clientId: 'b1c89b87-db4f-440a-8e5e-2e3dd8e43992', + clientId: ehrClientID, scope: 'launch patient/Patient.read patient/Questionnaire.read patient/Questionnaire.write patient/QuestionnaireResponse.read patient/QuestionnaireResponse.write openid profile online_access' }) .then(client => {