mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 23:07:42 -02:30
use optional chaining
This commit is contained in:
@@ -27,7 +27,7 @@ function HostAdd({ i18n }) {
|
|||||||
const { data: response } = await HostsAPI.create(values);
|
const { data: response } = await HostsAPI.create(values);
|
||||||
history.push(`${url}/${response.id}/details`);
|
history.push(`${url}/${response.id}/details`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response && error.response.data) {
|
if (error.response?.data) {
|
||||||
throw error.response.data;
|
throw error.response.data;
|
||||||
}
|
}
|
||||||
setFormError(error);
|
setFormError(error);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ function HostEdit({ host, i18n }) {
|
|||||||
await HostsAPI.update(host.id, values);
|
await HostsAPI.update(host.id, values);
|
||||||
history.push(detailsUrl);
|
history.push(detailsUrl);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response && error.response.data) {
|
if (error.response?.data) {
|
||||||
throw error.response.data;
|
throw error.response.data;
|
||||||
}
|
}
|
||||||
setFormError(error);
|
setFormError(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user