From 933d51783e04a7420af2efdce55672a98fc00c6c Mon Sep 17 00:00:00 2001 From: jimmyfagan Date: Fri, 13 Dec 2024 13:24:42 -0600 Subject: [PATCH] Control button for default data by client setting --- client/src/components/patientData.tsx | 27 ++++++++++++--------------- client/src/types/settings.ts | 4 +--- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/client/src/components/patientData.tsx b/client/src/components/patientData.tsx index 33d1dcf..c4d82c6 100644 --- a/client/src/components/patientData.tsx +++ b/client/src/components/patientData.tsx @@ -1,25 +1,18 @@ import { Button } from '@cmsgov/design-system'; import axios from 'axios'; import chart from '../images/who-charted.png' -//import { SettingsType } from '../types/settings'; +import { SettingsType } from '../types/settings'; import React, { useState } from 'react'; import * as process from 'process'; export default function PatientData() { const [header] = useState('Add your Medicare Prescription Drug data'); - // comment out below because the end point /api/authorize/authurl of - // the server component (on port 3001), does not take parameter such as pkce, version, env - // they are generated by the server component. - // - // const [settingsState] = useState({ - // pkce: true, - // version: 'v2', - // env: 'sandbox' - // }); + const [settingsState] = useState({ + useDefaultDataButton: false, // Set to true to use hard coded data + }); async function goAuthorize() { - // comment out '{ params: settingsState }' since /api/authorize/authurl does not take params const test_url = process.env.TEST_APP_API_URL ? process.env.TEST_APP_API_URL : '' - const authUrlResponseData = await axios.get(`${test_url}/api/authorize/authurl`/*, { params: settingsState } */) + const authUrlResponseData = await axios.get(`${test_url}/api/authorize/authurl`) .then(response => { return response.data; }) @@ -57,9 +50,13 @@ export default function PatientData() {
-
- -
+ { + settingsState.useDefaultDataButton ? +
+ +
: + null + } ); diff --git a/client/src/types/settings.ts b/client/src/types/settings.ts index a925883..1f261b3 100644 --- a/client/src/types/settings.ts +++ b/client/src/types/settings.ts @@ -1,5 +1,3 @@ export type SettingsType = { - env: 'sandbox' | 'local' | 'production', - version: 'v1' | 'v2', - pkce: boolean, + useDefaultDataButton: boolean, } \ No newline at end of file