mirror of
https://github.com/iflytek/skillhub.git
synced 2026-10-08 03:07:51 +00:00
fix(web): prevent landing page from matching nested routes
This commit is contained in:
parent
68af8047b8
commit
8171a190a7
2 changed files with 2 additions and 13 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { Suspense } from 'react'
|
||||
import { Outlet, Link, useRouterState } from '@tanstack/react-router'
|
||||
import { useAuth } from '@/features/auth/use-auth'
|
||||
import { LandingPage } from '@/pages/landing'
|
||||
|
||||
export function Layout() {
|
||||
const { user, isLoading } = useAuth()
|
||||
|
|
@ -8,11 +9,7 @@ export function Layout() {
|
|||
const isLanding = pathname === '/'
|
||||
|
||||
if (isLanding) {
|
||||
return (
|
||||
<Suspense fallback={null}>
|
||||
<Outlet />
|
||||
</Suspense>
|
||||
)
|
||||
return <LandingPage />
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ function lazyRouteComponent<TModule extends Record<string, unknown>>(
|
|||
return LazyComponent
|
||||
}
|
||||
|
||||
const LandingPage = lazyRouteComponent(() => import('@/pages/landing'), 'LandingPage')
|
||||
const HomePage = lazyRouteComponent(() => import('@/pages/home'), 'HomePage')
|
||||
const LoginPage = lazyRouteComponent(() => import('@/pages/login'), 'LoginPage')
|
||||
const RegisterPage = lazyRouteComponent(() => import('@/pages/register'), 'RegisterPage')
|
||||
|
|
@ -43,12 +42,6 @@ const rootRoute = createRootRoute({
|
|||
component: Layout,
|
||||
})
|
||||
|
||||
const homeRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: '/',
|
||||
component: LandingPage,
|
||||
})
|
||||
|
||||
const skillsRoute = createRoute({
|
||||
getParentRoute: () => rootRoute,
|
||||
path: '/skills',
|
||||
|
|
@ -303,7 +296,6 @@ const adminAuditLogRoute = createRoute({
|
|||
})
|
||||
|
||||
const routeTree = rootRoute.addChildren([
|
||||
homeRoute,
|
||||
skillsRoute,
|
||||
loginRoute,
|
||||
registerRoute,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue