Replace loadHost with an IIFE

This commit is contained in:
Marliana Lara
2020-01-22 12:25:43 -05:00
parent d33bbdd4f6
commit fc5363a140

View File

@@ -39,9 +39,11 @@ function Host({ inventory, i18n, setBreadcrumb }) {
? '/hosts'
: `/inventories/inventory/${inventoriesMatch.params.id}/hosts`;
const loadHost = async () => {
useEffect(() => {
(async () => {
setContentError(null);
setHasContentLoading(true);
try {
const hostId = hostsMatch
? hostsMatch.params.id
@@ -59,10 +61,7 @@ function Host({ inventory, i18n, setBreadcrumb }) {
} finally {
setHasContentLoading(false);
}
};
useEffect(() => {
loadHost();
})();
}, [location]); // eslint-disable-line react-hooks/exhaustive-deps
const tabsArray = [