import { createBrowserRouter } from "react-router-dom"; import CollectionDashboard from "@/pages/CollectionDashboard"; import CollectionSpace from "@/pages/CollectionSpace"; import NotFound from "@/pages/NotFound"; import SignIn from "@/pages/SignIn"; import SignUp from "@/pages/SignUp"; import SubscriptionSetting from "@/pages/SubscriptionSetting"; import UserSetting from "@/pages/UserSetting"; import WorkspaceSetting from "@/pages/WorkspaceSetting"; import App from "../App"; import Root from "../layouts/Root"; import Home from "../pages/Home"; import ShortcutDetail from "../pages/ShortcutDetail"; import { shortcutService } from "../services"; const router = createBrowserRouter([ { path: "/", element: , children: [ { path: "/auth", element: , }, { path: "/auth/signup", element: , }, { path: "", element: , children: [ { path: "/", element: , }, { path: "/collections", element: , }, { path: "/shortcut/:shortcutId", element: , loader: async ({ params }) => { const shortcut = await shortcutService.getOrFetchShortcutById(Number(params.shortcutId)); return shortcut; }, }, { path: "/setting/general", element: , }, { path: "/setting/workspace", element: , }, { path: "/setting/subscription", element: , }, ], }, { path: "c/:collectionName", element: , }, { path: "*", element: , }, ], }, ]); export default router;