mirror of
https://github.com/ansible/awx.git
synced 2026-05-22 08:17:39 -02:30
Replace loadHost with an IIFE
This commit is contained in:
@@ -39,9 +39,11 @@ function Host({ inventory, i18n, setBreadcrumb }) {
|
|||||||
? '/hosts'
|
? '/hosts'
|
||||||
: `/inventories/inventory/${inventoriesMatch.params.id}/hosts`;
|
: `/inventories/inventory/${inventoriesMatch.params.id}/hosts`;
|
||||||
|
|
||||||
const loadHost = async () => {
|
useEffect(() => {
|
||||||
|
(async () => {
|
||||||
setContentError(null);
|
setContentError(null);
|
||||||
setHasContentLoading(true);
|
setHasContentLoading(true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const hostId = hostsMatch
|
const hostId = hostsMatch
|
||||||
? hostsMatch.params.id
|
? hostsMatch.params.id
|
||||||
@@ -59,10 +61,7 @@ function Host({ inventory, i18n, setBreadcrumb }) {
|
|||||||
} finally {
|
} finally {
|
||||||
setHasContentLoading(false);
|
setHasContentLoading(false);
|
||||||
}
|
}
|
||||||
};
|
})();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
loadHost();
|
|
||||||
}, [location]); // eslint-disable-line react-hooks/exhaustive-deps
|
}, [location]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||||
|
|
||||||
const tabsArray = [
|
const tabsArray = [
|
||||||
|
|||||||
Reference in New Issue
Block a user