refactor(GoogleCloud): Clean up some of the Healthcare API Adapter components (#641)

This commit is contained in:
Erik Ziegler authored and GitHub committed 2019-07-10 14:54:27 +02:00
1 parent 4a09f33446
commit 091cab49e0
21 files changed
+613 -438

No files matched your search

+16 -13
View File
@@ -5,14 +5,11 @@ import DatasetsList from './DatasetsList';
import './googleCloud.css';
export default class DatasetPicker extends Component {
constructor(props) {
super(props);
this.state = {
error: null,
loading: false,
datasets: [],
};
}
state = {
error: null,
loading: true,
datasets: [],
};
static propTypes = {
project: PropTypes.object,
@@ -20,7 +17,6 @@ export default class DatasetPicker extends Component {
onSelect: PropTypes.func,
oidcKey: PropTypes.string,
};
static defaultProps = {};
async componentDidMount() {
api.setOidcStorageKey(this.props.oidcKey);
@@ -29,12 +25,19 @@ export default class DatasetPicker extends Component {
this.props.project.projectId,
this.props.location.locationId
);
this.loading = false;
if (response.isError) {
this.error = response.message;
this.setState({
error: response.message,
});
return;
}
this.setState({ datasets: response.data.datasets || [] });
this.setState({
datasets: response.data.datasets || [],
loading: false,
});
}
render() {
@@ -46,7 +49,7 @@ export default class DatasetPicker extends Component {
loading={loading}
error={error}
onSelect={onSelect}
></DatasetsList>
/>
);
}
}