import { Route, Routes, useNavigate } from "react-router-dom";
import "./assets/base.less";
import Nav from "./components/Nav";
import { routerList } from "./router";
import { Guard } from "./router/Guard";

function App() {
  return (
    <>
      <Nav />
      <main>
        <Routes>
          {routerList.map((router) => (
            <Route
              key={router.path}
              path={router.path}
              element={<Guard>{router.element}</Guard>}
            />
          ))}
          <Route path="*" element={<span>404</span>} />
        </Routes>
      </main>
    </>
  );
}

export default App;
