import { defineRoutes } from "tempest-react-sdk";
import { RootLayout } from "@/layouts/RootLayout";
import { Home } from "@/pages/Home";
import { Login } from "@/pages/Login";
import { useAuth } from "@/stores/auth";
/**
* Declarative route tree. `lazy` code-splits a page (with retry on stale
* chunks); `guard` redirects when the predicate is falsy — here, reading the
* auth store keeps protected pages behind login.
*/
export const routes = defineRoutes([
{
path: "/",
element: ,
children: [
{ index: true, element: },
{ path: "login", element: },
{
path: "dashboard",
lazy: () => import("@/pages/Dashboard"),
guard: () => useAuth.getState().isAuthenticated,
redirectTo: "/login",
},
],
},
]);