Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/components/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { BrowserRouter , HashRouter , Routes, Route } from 'react-router-dom';
import { BrowserRouter, HashRouter, Routes, Route } from 'react-router-dom';
import RequestBuilder from '../containers/RequestBuilder';
import PatientPortal from '../containers/PatientPortal';
import theme from '../containers/styles/theme';
Expand All @@ -14,18 +14,17 @@ const App = () => {
return (
<Router>
<Routes>
<Route path='/launch' element={<Launch redirect={redirect} />} />
<Route path='/index' element={<Index />} />
<Route path="/launch" element={<Launch redirect={redirect} />} />
<Route path="/index" element={<Index />} />
<Route
path='/patient-portal'
path="/patient-portal"
element={
<ThemeProvider theme={theme}>
<PatientPortal />
</ThemeProvider>
}
/>
<Route path="/" exact element={<RequestBuilder redirect = {redirect} />} />

<Route path="/" exact element={<RequestBuilder redirect={redirect} />} />
</Routes>
</Router>
);
Expand Down
6 changes: 5 additions & 1 deletion src/components/RequestBox/RequestBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,11 @@ export default class RequestBox extends Component {
}

renderError() {
return <span className="patient-error">Encountered Error: Try Refreshing The Client <br /> {this.state.patientList.message} </span>;
return (
<span className="patient-error">
Encountered Error: Try Refreshing The Client <br /> {this.state.patientList.message}{' '}
</span>
);
}

launchSmartOnFhirApp = () => {
Expand Down
16 changes: 14 additions & 2 deletions src/containers/Launch.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
import React, { memo, useState, useEffect } from 'react';
import FHIR from 'fhirclient';
import env from 'env-var';
import queryString from 'querystring';

const Launch = (props) => {
const Launch = props => {
useEffect(() => {
// this is a workaround for the fhir client not being able to pull values out of the
// hash. Regex will look for different permutations of a hashrouter url /#/launch /#launch #launch /#launch
const params = queryString.parse((window.location.hash || '').replace(/\/?#\/?launch\?/, ''));

// if these are null then the client will pull them out of the browsers query string
// so we don't need to do that here.
const iss = params.iss;
const launch = params.launch;

FHIR.oauth2.authorize({
clientId: env.get('REACT_APP_CLIENT').asString(),
scope: env.get('REACT_APP_CLIENT_SCOPES').asString(),
redirectUri: props.redirect
redirectUri: props.redirect,
iss: iss,
launch: launch
});
}, []);

Expand Down
13 changes: 6 additions & 7 deletions src/containers/RequestBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,12 @@ export default class RequestBuilder extends Component {
}

reconnectEhr() {
FHIR.oauth2
.authorize({
clientId: env.get('REACT_APP_CLIENT').asString(),
iss: this.state.baseUrl,
redirectUri: this.props.redirect,
scope: env.get('REACT_APP_CLIENT_SCOPES').asString()
});
FHIR.oauth2.authorize({
clientId: env.get('REACT_APP_CLIENT').asString(),
iss: this.state.baseUrl,
redirectUri: this.props.redirect,
scope: env.get('REACT_APP_CLIENT_SCOPES').asString()
});
}

consoleLog(content, type) {
Expand Down