Skip to content

Commit

Permalink
Merge pull request #229 from BinaryStudioAcademy/fix/OV-220-add-loade…
Browse files Browse the repository at this point in the history
…r-overlay

OV-220: Wrap loader in overlay
  • Loading branch information
nikita-remeslov authored Sep 10, 2024
2 parents 529b0f6 + ca3dd8b commit f43f095
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Loader, Navigate } from '~/bundles/common/components/components.js';
import {
Loader,
Navigate,
Overlay,
} from '~/bundles/common/components/components.js';
import { AppRoute, DataStatus } from '~/bundles/common/enums/enums.js';
import { useAppSelector } from '~/bundles/common/hooks/hooks.js';

Expand All @@ -10,7 +14,11 @@ const ProtectedRoute: React.FC<Properties> = ({ children }) => {
const { user, dataStatus } = useAppSelector((state) => state.auth);

if (dataStatus === DataStatus.PENDING) {
return <Loader />;
return (
<Overlay isOpen>
<Loader />
</Overlay>
);
}

if (dataStatus === DataStatus.REJECTED) {
Expand Down

0 comments on commit f43f095

Please sign in to comment.