mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 12:41:19 -03:30
Fix unhandled promise reject from jenkins.
This commit is contained in:
parent
03f6e52cf1
commit
b0855ee33d
@ -45,7 +45,6 @@ class APIClient {
|
||||
}
|
||||
|
||||
get = (endpoint) => this.http.get(endpoint);
|
||||
|
||||
}
|
||||
|
||||
export default new APIClient();
|
||||
|
||||
@ -15,17 +15,24 @@ class Organizations extends Component {
|
||||
constructor (props) {
|
||||
super(props);
|
||||
|
||||
this.state = { organizations: [] };
|
||||
this.state = {
|
||||
organizations: [],
|
||||
error: false,
|
||||
};
|
||||
}
|
||||
|
||||
async componentDidMount () {
|
||||
const { data } = await api.get(API_ORGANIZATIONS);
|
||||
this.setState({ organizations: data.results });
|
||||
try {
|
||||
const { data } = await api.get(API_ORGANIZATIONS);
|
||||
this.setState({ organizations: data.results });
|
||||
} catch (err) {
|
||||
this.setState({ error: err });
|
||||
}
|
||||
}
|
||||
|
||||
render () {
|
||||
const { light, medium } = PageSectionVariants;
|
||||
const { organizations } = this.state;
|
||||
const { organizations, error } = this.state;
|
||||
|
||||
return (
|
||||
<Fragment>
|
||||
@ -39,6 +46,7 @@ class Organizations extends Component {
|
||||
<OrganizationCard key={o.id} organization={o} />
|
||||
</GalleryItem>
|
||||
))}
|
||||
{ error ? <div>error</div> : '' }
|
||||
</Gallery>
|
||||
</PageSection>
|
||||
</Fragment>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user