Make login and logout lazy load

This commit is contained in:
sianida26 2024-05-07 23:18:36 +07:00
parent 21fbf0e495
commit 790b9731c2
3 changed files with 10 additions and 10 deletions

View File

@ -14,13 +14,13 @@ import { createFileRoute } from '@tanstack/react-router'
import { Route as rootRoute } from './routes/__root' import { Route as rootRoute } from './routes/__root'
import { Route as DashboardLayoutImport } from './routes/_dashboardLayout' import { Route as DashboardLayoutImport } from './routes/_dashboardLayout'
import { Route as LogoutIndexImport } from './routes/logout/index'
import { Route as LoginIndexImport } from './routes/login/index'
import { Route as DashboardLayoutDashboardIndexImport } from './routes/_dashboardLayout/dashboard/index' import { Route as DashboardLayoutDashboardIndexImport } from './routes/_dashboardLayout/dashboard/index'
// Create Virtual Routes // Create Virtual Routes
const IndexLazyImport = createFileRoute('/')() const IndexLazyImport = createFileRoute('/')()
const LogoutIndexLazyImport = createFileRoute('/logout/')()
const LoginIndexLazyImport = createFileRoute('/login/')()
const DashboardLayoutUsersIndexLazyImport = createFileRoute( const DashboardLayoutUsersIndexLazyImport = createFileRoute(
'/_dashboardLayout/users/', '/_dashboardLayout/users/',
)() )()
@ -37,15 +37,15 @@ const IndexLazyRoute = IndexLazyImport.update({
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
} as any).lazy(() => import('./routes/index.lazy').then((d) => d.Route)) } as any).lazy(() => import('./routes/index.lazy').then((d) => d.Route))
const LogoutIndexRoute = LogoutIndexImport.update({ const LogoutIndexLazyRoute = LogoutIndexLazyImport.update({
path: '/logout/', path: '/logout/',
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
} as any) } as any).lazy(() => import('./routes/logout/index.lazy').then((d) => d.Route))
const LoginIndexRoute = LoginIndexImport.update({ const LoginIndexLazyRoute = LoginIndexLazyImport.update({
path: '/login/', path: '/login/',
getParentRoute: () => rootRoute, getParentRoute: () => rootRoute,
} as any) } as any).lazy(() => import('./routes/login/index.lazy').then((d) => d.Route))
const DashboardLayoutUsersIndexLazyRoute = const DashboardLayoutUsersIndexLazyRoute =
DashboardLayoutUsersIndexLazyImport.update({ DashboardLayoutUsersIndexLazyImport.update({
@ -74,11 +74,11 @@ declare module '@tanstack/react-router' {
parentRoute: typeof rootRoute parentRoute: typeof rootRoute
} }
'/login/': { '/login/': {
preLoaderRoute: typeof LoginIndexImport preLoaderRoute: typeof LoginIndexLazyImport
parentRoute: typeof rootRoute parentRoute: typeof rootRoute
} }
'/logout/': { '/logout/': {
preLoaderRoute: typeof LogoutIndexImport preLoaderRoute: typeof LogoutIndexLazyImport
parentRoute: typeof rootRoute parentRoute: typeof rootRoute
} }
'/_dashboardLayout/dashboard/': { '/_dashboardLayout/dashboard/': {
@ -100,8 +100,8 @@ export const routeTree = rootRoute.addChildren([
DashboardLayoutDashboardIndexRoute, DashboardLayoutDashboardIndexRoute,
DashboardLayoutUsersIndexLazyRoute, DashboardLayoutUsersIndexLazyRoute,
]), ]),
LoginIndexRoute, LoginIndexLazyRoute,
LogoutIndexRoute, LogoutIndexLazyRoute,
]) ])
/* prettier-ignore-end */ /* prettier-ignore-end */