11import { Button } from '@cmsgov/design-system' ;
22import axios from 'axios' ;
33import chart from '../images/who-charted.png'
4- // import { SettingsType } from '../types/settings';
4+ import { SettingsType } from '../types/settings' ;
55import React , { useState } from 'react' ;
66import * as process from 'process' ;
77
@@ -11,15 +11,12 @@ export default function PatientData() {
1111 // the server component (on port 3001), does not take parameter such as pkce, version, env
1212 // they are generated by the server component.
1313 //
14- // const [settingsState] = useState<SettingsType>({
15- // pkce: true,
16- // version: 'v2',
17- // env: 'sandbox'
18- // });
14+ const [ settingsState ] = useState < SettingsType > ( {
15+ useDefaultDataButton : true ,
16+ } ) ;
1917 async function goAuthorize ( ) {
20- // comment out '{ params: settingsState }' since /api/authorize/authurl does not take params
2118 const test_url = process . env . TEST_APP_API_URL ? process . env . TEST_APP_API_URL : ''
22- const authUrlResponseData = await axios . get ( `${ test_url } /api/authorize/authurl` /*, { params: settingsState } */ )
19+ const authUrlResponseData = await axios . get ( `${ test_url } /api/authorize/authurl` )
2320 . then ( response => {
2421 return response . data ;
2522 } )
@@ -32,8 +29,8 @@ export default function PatientData() {
3229 console . log ( authUrlResponseData ) ;
3330 }
3431 async function goLoadDefaults ( ) {
35- const authUrlResponse = await axios . get ( `/api/bluebutton/loadDefaults` ) ;
36- window . location . href = authUrlResponse . data || '/' ;
32+ const loadDefaultsData = await axios . get ( `/api/bluebutton/loadDefaults` ) ;
33+ window . location . href = loadDefaultsData . data || '/' ;
3734 }
3835
3936 /* DEVELOPER NOTES:
@@ -57,9 +54,13 @@ export default function PatientData() {
5754 < div className = 'ds-u-margin-top--2' >
5855 < Button id = "auth_btn" variation = "solid" onClick = { goAuthorize } > Authorize</ Button >
5956 </ div >
60- < div className = 'ds-u-margin-top--2' >
61- < Button id = "load_defaults_btn" variation = "solid" onClick = { goLoadDefaults } > Load default data</ Button >
62- </ div >
57+ {
58+ settingsState . useDefaultDataButton ?
59+ < div className = 'ds-u-margin-top--2' >
60+ < Button id = "load_defaults_btn" variation = "primary" onClick = { goLoadDefaults } > Load default data</ Button >
61+ </ div > :
62+ null
63+ }
6364 </ div >
6465 </ div >
6566 ) ;
0 commit comments