import { lazy, Suspense } from "react";
import { createBrowserRouter, Navigate, Outlet } from "react-router-dom";
import { useAuthStore } from "../store/authStore";
import { Spinner } from "@/components/ui/spinner";
import { DashboardLayout } from "@/layouts/DashboardLayout";
const LoginPage = lazy(() => import("@/pages/login"));
const DashboardPage = lazy(() => import("@/pages/dashboard"));
const LoanOrdersPage = lazy(() => import("@/pages/loanOrders"));
const LoanOrderMobilesPage = lazy(() => import("@/pages/loanOrderMobiles"));
const LoanRemainingPage = lazy(() => import("@/pages/loanRemaining"));
const LoanPaidOffLettersPage = lazy(() => import("@/pages/loanPaidOffLetters"));
const LoanOrderCreatePage = lazy(() => import("@/pages/loanOrderCreate"));
const LoanOrderViewPage = lazy(() => import("@/pages/loanOrderView"));
function AuthGuard() {
const isAuthenticated = useAuthStore((s) => s.isAuthenticated);
if (!isAuthenticated) return