|
1 | 1 | import { Button } from '@cmsgov/design-system';
|
2 | 2 | import axios from 'axios';
|
3 | 3 | import chart from '../images/who-charted.png'
|
4 |
| -//import { SettingsType } from '../types/settings'; |
| 4 | +import { SettingsType } from '../types/settings'; |
5 | 5 | import React, { useState } from 'react';
|
6 | 6 | import * as process from 'process';
|
7 | 7 |
|
8 | 8 | export default function PatientData() {
|
9 | 9 | 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 | + }); |
19 | 13 | async function goAuthorize() {
|
20 |
| - // comment out '{ params: settingsState }' since /api/authorize/authurl does not take params |
21 | 14 | 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`) |
23 | 16 | .then(response => {
|
24 | 17 | return response.data;
|
25 | 18 | })
|
@@ -57,9 +50,13 @@ export default function PatientData() {
|
57 | 50 | <div className='ds-u-margin-top--2'>
|
58 | 51 | <Button id="auth_btn" variation="primary" onClick={goAuthorize}>Authorize</Button>
|
59 | 52 | </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 | + } |
63 | 60 | </div>
|
64 | 61 | </div>
|
65 | 62 | );
|
|
0 commit comments