From 770a3a65561c7913de8691f77cb299301a16ca26 Mon Sep 17 00:00:00 2001 From: Anastasiia Date: Fri, 5 Apr 2024 16:07:02 +0300 Subject: [PATCH] MSP-3103 update Routers and add lazy --- src/routes/Routers/index.tsx | 50 ++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/src/routes/Routers/index.tsx b/src/routes/Routers/index.tsx index af8aeac..9b31425 100644 --- a/src/routes/Routers/index.tsx +++ b/src/routes/Routers/index.tsx @@ -1,28 +1,50 @@ -import { App } from 'antd' +import { Spin } from 'antd' +import { Suspense, lazy } from 'react' import { Route, Routes } from 'react-router-dom' -import ErrorPage from '@components/ErrorPage' import Layout from '@components/Layout' -import HomePages from '@pages/HomePage' -import LoginPage from '@pages/LoginPage' +import HomePage from '@pages/HomePage' import PrivateRoute from '@routes/PrivateRoute' import { routePaths } from '@routes/routePaths.ts' +const LoginPage = lazy(() => import('@pages/LoginPage')) + +const ErrorPage = lazy(() => import('@components/ErrorPage')) + const Routers = () => { return ( - - - }> - }> - } /> - + + }> + }> + }> + + + } + /> - } /> - } /> - - + + }> + + + } + /> + }> + + + } + /> + ) }