Skip to content

Commit 933d517

Browse files
committed
Control button for default data by client setting
1 parent 026c135 commit 933d517

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

client/src/components/patientData.tsx

+12-15
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
11
import { Button } from '@cmsgov/design-system';
22
import axios from 'axios';
33
import chart from '../images/who-charted.png'
4-
//import { SettingsType } from '../types/settings';
4+
import { SettingsType } from '../types/settings';
55
import React, { useState } from 'react';
66
import * as process from 'process';
77

88
export default function PatientData() {
99
const [header] = useState('Add your Medicare Prescription Drug data');
10-
// comment out below because the end point /api/authorize/authurl of
11-
// the server component (on port 3001), does not take parameter such as pkce, version, env
12-
// they are generated by the server component.
13-
//
14-
// const [settingsState] = useState<SettingsType>({
15-
// pkce: true,
16-
// version: 'v2',
17-
// env: 'sandbox'
18-
// });
10+
const [settingsState] = useState<SettingsType>({
11+
useDefaultDataButton: false, // Set to true to use hard coded data
12+
});
1913
async function goAuthorize() {
20-
// comment out '{ params: settingsState }' since /api/authorize/authurl does not take params
2114
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 } */)
15+
const authUrlResponseData = await axios.get(`${test_url}/api/authorize/authurl`)
2316
.then(response => {
2417
return response.data;
2518
})
@@ -57,9 +50,13 @@ export default function PatientData() {
5750
<div className='ds-u-margin-top--2'>
5851
<Button id="auth_btn" variation="primary" onClick={goAuthorize}>Authorize</Button>
5952
</div>
60-
<div className='ds-u-margin-top--2'>
61-
<Button id="load_defaults_btn" variation="primary" onClick={goLoadDefaults}>Load default data</Button>
62-
</div>
53+
{
54+
settingsState.useDefaultDataButton ?
55+
<div className='ds-u-margin-top--2'>
56+
<Button id="load_defaults_btn" variation="primary" onClick={goLoadDefaults}>Load default data</Button>
57+
</div> :
58+
null
59+
}
6360
</div>
6461
</div>
6562
);

client/src/types/settings.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
export type SettingsType = {
2-
env: 'sandbox' | 'local' | 'production',
3-
version: 'v1' | 'v2',
4-
pkce: boolean,
2+
useDefaultDataButton: boolean,
53
}

0 commit comments

Comments
 (0)