From 037c2595495e642bc787ee6d0a5ae3d4813039b8 Mon Sep 17 00:00:00 2001 From: Paul Bugni Date: Mon, 11 Jul 2022 16:07:53 -0700 Subject: [PATCH 1/2] Bring together front and backend client details, by acting on presence of REACT_APP_BACKEND_URL. --- src/components/Launch.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/Launch.js b/src/components/Launch.js index b196da0d..4e95fd9f 100644 --- a/src/components/Launch.js +++ b/src/components/Launch.js @@ -12,12 +12,18 @@ export default function Launch() { React.useEffect(() => { + if (process.env.REACT_APP_BACKEND_URL) { + const authURL = `${process.env.REACT_APP_BACKEND_URL}/auth/auth-info`; + } else { + const authURL = 'launch-context.json'; + } const urlParams = new URLSearchParams(window.location.search); //retrieve patient id from URL querystring if any let patientId = urlParams.get('patient'); console.log("patient id from url query string: ", patientId); + console.log("authURL: ", authURL); - fetch('launch-context.json', { + fetch(authURL, { // include cookies in request credentials: 'include' }) From b190b4a2f608f9df9522af1f0bfa67ec9cc41b41 Mon Sep 17 00:00:00 2001 From: Amy Chen Date: Mon, 11 Jul 2022 16:37:29 -0700 Subject: [PATCH 2/2] fix syntax error --- src/components/Launch.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/components/Launch.js b/src/components/Launch.js index 4e95fd9f..e3c2c466 100644 --- a/src/components/Launch.js +++ b/src/components/Launch.js @@ -11,17 +11,15 @@ export default function Launch() { const [error, setError] = React.useState(''); React.useEffect(() => { - - if (process.env.REACT_APP_BACKEND_URL) { - const authURL = `${process.env.REACT_APP_BACKEND_URL}/auth/auth-info`; - } else { - const authURL = 'launch-context.json'; - } + let authURL = 'launch-context.json'; + if (process.env.REACT_APP_BACKEND_URL) { + authURL = `${process.env.REACT_APP_BACKEND_URL}/auth/auth-info`; + } const urlParams = new URLSearchParams(window.location.search); //retrieve patient id from URL querystring if any let patientId = urlParams.get('patient'); console.log("patient id from url query string: ", patientId); - console.log("authURL: ", authURL); + console.log("authURL: ", authURL); fetch(authURL, { // include cookies in request