mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 02:47:35 -02:30
Redirect user to org detail page after successful POST.
This commit is contained in:
@@ -75,6 +75,7 @@ class OrganizationAdd extends React.Component {
|
|||||||
const data = Object.assign({}, { ...this.state });
|
const data = Object.assign({}, { ...this.state });
|
||||||
try {
|
try {
|
||||||
const { data: response } = await api.createOrganization(data);
|
const { data: response } = await api.createOrganization(data);
|
||||||
|
console.log(response);
|
||||||
const url = response.related.instance_groups;
|
const url = response.related.instance_groups;
|
||||||
const selected = this.state.results.filter(group => group.isChecked);
|
const selected = this.state.results.filter(group => group.isChecked);
|
||||||
try {
|
try {
|
||||||
@@ -82,6 +83,8 @@ class OrganizationAdd extends React.Component {
|
|||||||
this.resetForm();
|
this.resetForm();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.setState({ createInstanceGroupsError: err })
|
this.setState({ createInstanceGroupsError: err })
|
||||||
|
} finally {
|
||||||
|
this.onSuccess(response.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
@@ -93,6 +96,10 @@ class OrganizationAdd extends React.Component {
|
|||||||
this.props.history.push('/organizations');
|
this.props.history.push('/organizations');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onSuccess(id) {
|
||||||
|
this.props.history.push(`/organizations/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
const { api } = this.props;
|
const { api } = this.props;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user