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
2 changes: 1 addition & 1 deletion src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import RegisterPage from '../containers/register/RegisterPage';
import theme from '../containers/styles/theme';
const isGhPages = process.env.REACT_APP_GH_PAGES === 'true';
const Router = isGhPages ? HashRouter : BrowserRouter;
const redirect = isGhPages ? '/#/index' : '/index';
const redirect = isGhPages ? '/request-generator/#/index' : '/index';
const App = () => {
return (
<Router>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import './InProgressFormBoxStyle.css';

export default function InProgressFormBox(props) {
return (
props.qrResponse.questionnaire ? (
props.qrResponse?.questionnaire ? (
<Box className={'inprogress-container'}>
<Typography variant='h6' color='text.primary' gutterBottom>
In Progress Form
Expand Down
10 changes: 6 additions & 4 deletions src/components/RequestBox/RequestBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,12 @@ export default class RequestBox extends Component {
</div>
</div>
<div className="action-btns">
<InProgressFormBox
qrResponse={this.props.response}
relaunch={this.relaunch}
/>
{Object.keys(this.props.response).length ?
<InProgressFormBox
qrResponse={this.props.response}
relaunch={this.relaunch}
/>
: <span />}
<ButtonGroup variant="outlined" aria-label="outlined button group">
<Button onClick={this.launchSmartOnFhirApp} disabled={disableLaunchSmartOnFhir}>
Launch SMART on FHIR App
Expand Down
12 changes: 9 additions & 3 deletions src/containers/Launch.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import env from 'env-var';
import queryString from 'querystring';
import FHIR from 'fhirclient';
import React, { memo, useEffect, useState } from 'react';
import RegisterPage from './register/RegisterPage';
Expand All @@ -25,8 +26,11 @@ const Launch = props => {
}
}
const urlSearchString = window.location.search;
const params = new URLSearchParams(urlSearchString);
const iss = params.get('iss');
const params = queryString.parse((window.location.hash || '').replace(/\/?#\/?launch\?/, ''));
const iss = params.iss;
console.log('iss: ' + iss);
const launch = params.launch;
console.log('launch: ' + launch);
if (iss) {
const storedClient = clients.find(e => {
return e.name == iss;
Expand All @@ -39,7 +43,9 @@ const Launch = props => {
.authorize({
clientId: clientId,
scope: env.get('REACT_APP_CLIENT_SCOPES').asString(),
redirectUri: '/index'
redirectUri: props.redirect,
iss: iss,
launch: launch
})
.catch(e => {
console.log(e);
Expand Down
2 changes: 1 addition & 1 deletion src/containers/RequestBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ export default class RequestBuilder extends Component {
})
.catch(() => {
this.consoleLog('No response received from the server', types.error);
this.setState({ response: null });
this.setState({ response: {} });
this.setState({ loading: false });
});
} catch (error) {
Expand Down