mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 18:37:39 -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,17 +83,23 @@ 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) {
|
||||||
this.setState({ onSubmitError: err })
|
this.setState({ onSubmitError: err })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onCancel() {
|
onCancel() {
|
||||||
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