Skip to content

Commit

Permalink
update conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
adonispuente authored and lucasgarfield committed Aug 16, 2023
1 parent 8596b01 commit ea92d7f
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,21 @@ const LandingPage = lazy(() => import('./Components/LandingPage/LandingPage'));
const CreateImageWizard = lazy(() =>
import('./Components/CreateImageWizard/CreateImageWizard')
);
const INVENTORY_TOTAL_FETCH_URL = '/api/inventory/v1/hosts';
const IMAGES_TOTAL_FETCH_URL = '/api/image-builder/v1/composes';

export const Router = () => {
const [hasSystems, setHasSystems] = useState(true);
const [hadImages, setHadImages] = useState(true);
const [selected, setSelected] = useState(false);
useEffect(() => {
try {
axios
.get(`${INVENTORY_TOTAL_FETCH_URL}?page=1&per_page=1`)
.then(({ data }) => {
setHasSystems(data.total > 0);
});
axios.get(`${IMAGES_TOTAL_FETCH_URL}?limit=1`).then(({ data }) => {
setHadImages(data.meta.count > 0);
});
} catch (e) {
/*eslint-disable no-console*/
console.log(e);
/*eslint-enable no-console*/
}
}, [hasSystems]);
}, [hadImages]);
const edgeParityFlag = useFlag('edgeParity.image-list');
return (
<Suspense
Expand All @@ -42,7 +39,7 @@ export const Router = () => {
</Bullseye>
}
>
{!hasSystems ? (
{!hadImages ? (
<AsyncComponent
appName="dashboard"
module="./AppZeroState"
Expand Down

0 comments on commit ea92d7f

Please sign in to comment.