diff --git a/src/features/Main/index.jsx b/src/features/Main/index.jsx index dff82d4..4bad677 100644 --- a/src/features/Main/index.jsx +++ b/src/features/Main/index.jsx @@ -9,7 +9,7 @@ import { } from 'react-router-dom'; import { getConfig } from '@edx/frontend-platform'; -import { Container } from '@edx/paragon'; +import { Container, Spinner } from '@edx/paragon'; import CookiePolicyBanner from '@pearsonedunext/frontend-component-cookie-policy-banner'; @@ -36,7 +36,7 @@ import { updateSelectedInstitution } from 'features/Main/data/slice'; import { useInstitutionIdQueryParam } from 'hooks'; -import { cookieText, INSTITUTION_QUERY_ID } from 'features/constants'; +import { cookieText, INSTITUTION_QUERY_ID, RequestStatus } from 'features/constants'; import './index.scss'; @@ -49,6 +49,9 @@ const Main = () => { const searchParams = new URLSearchParams(location.search); + const statusInstitutions = useSelector((state) => state.main.institution.status); + const isLoadingInstitutions = statusInstitutions === RequestStatus.LOADING; + useEffect(() => { dispatch(fetchInstitutionData()); }, [dispatch]); @@ -82,8 +85,17 @@ const Main = () => {
- {institutions.length < 1 && } - {institutions.length > 0 && ( + {isLoadingInstitutions && ( +
+ +
+ )} + {!isLoadingInstitutions && institutions.length < 1 && } + {!isLoadingInstitutions && institutions.length > 0 && ( <>