import { lazy } from 'react';
import { Navigate } from 'react-router-dom';
import { lazyLoad, authComponent } from './lazyLoadAndDelay'; // 添加一个固定的延迟时间，以便你可以看到加载状态

import Layout from '@/layout/index';
import UserModule from '@/pages/user-module';

const baseRouter = [
  {
    path: '/',
    element: authComponent(Layout),
    children: [
      {
        path: '/userinfo',
        Component: lazy(() => import('@/pages/user-module/userInfo')),
      },
    ],
  },
  {
    path: '/login',
    element: lazyLoad(UserModule),
    // Component: lazy(() => import('@/pages/user-module')),
    children: [
      {
        index: true,
        Component: lazy(() => import('@/pages/user-module/login')),
      },
    ],
  },
  { path: '*', element: <Navigate to='/' /> },
];

export default baseRouter;
