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