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