fix: connect API to tracker.db via SQLite repository
Deploy / Deploy Staging (push) Failing after 9s
Deploy / Deploy Production (push) Has been skipped
Tests / test (push) Failing after 14s
Tests / lint (push) Failing after 15s

This commit is contained in:
Xiaoxia AI
2026-06-17 13:21:38 +08:00
parent 3bf90f8614
commit 2cda8dec39
67 changed files with 5737 additions and 123 deletions
+98
View File
@@ -0,0 +1,98 @@
/**
* 更新路由,添加 Admin 和 Billing 页面
*/
import { createBrowserRouter, Navigate } from 'react-router-dom';
import MainLayout from '@/components/layout/MainLayout';
import Login from '@/pages/auth/Login';
import Register from '@/pages/auth/Register';
import ForgotPassword from '@/pages/auth/ForgotPassword';
import ResetPassword from '@/pages/auth/ResetPassword';
import { useAuthStore } from '@/store/authStore';
// 受保护的路由组件
const ProtectedRoute = ({ children }: { children: React.ReactNode }) => {
const isAuthenticated = useAuthStore((state) => state.isAuthenticated);
if (!isAuthenticated) {
return <Navigate to="/login" replace />;
}
return <>{children}</>;
};
// 路由配置
export const router = createBrowserRouter([
{
path: '/login',
element: <Login />,
},
{
path: '/register',
element: <Register />,
},
{
path: '/forgot-password',
element: <ForgotPassword />,
},
{
path: '/reset-password',
element: <ResetPassword />,
},
{
path: '/',
element: (
<ProtectedRoute>
<MainLayout />
</ProtectedRoute>
),
children: [
{
index: true,
element: <Navigate to="/workspaces" replace />,
},
{
path: 'workspaces',
lazy: () => import('@/pages/workspace/WorkspaceList'),
},
{
path: 'workspaces/:id',
lazy: () => import('@/pages/workspace/WorkspaceDetail'),
},
{
path: 'subscription',
lazy: () => import('@/pages/subscription/Plans'),
},
{
path: 'subscription/upgrade/:workspaceId',
lazy: () => import('@/pages/subscription/UpgradeSubscription'),
},
{
path: 'subscription/billing',
lazy: () => import('@/pages/subscription/Billing'),
},
{
path: 'admin',
children: [
{
index: true,
lazy: () => import('@/pages/admin/Dashboard'),
},
{
path: 'users',
lazy: () => import('@/pages/admin/UserManagement'),
},
],
},
{
path: 'profile',
lazy: () => import('@/pages/profile/Settings'),
},
],
},
{
path: '*',
element: <Navigate to="/" replace />,
},
]);
export default router;