Hide manual trade by default, block open while running, auto-refresh auth token.

Also fix flat-side reconcile to check both long and short residuals; document in 更新说明.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-26 22:43:38 +08:00
parent 0cf3756b09
commit 16efa44ffb
13 changed files with 304 additions and 38 deletions
+11 -2
View File
@@ -1,6 +1,11 @@
import type { ReactNode } from "react";
import { type ReactNode, useEffect } from "react";
import { NavLink, Navigate, Route, Routes } from "react-router-dom";
import { clearSession, getToken, getUsername } from "./api/client";
import {
clearSession,
getToken,
getUsername,
startAuthTokenAutoRefresh,
} from "./api/client";
import LoginPage from "./pages/Login";
import PlanPage from "./pages/Plan";
import TradesPage from "./pages/Trades";
@@ -58,6 +63,10 @@ function Shell({ children }: { children: ReactNode }) {
}
function RequireAuth({ children }: { children: ReactNode }) {
useEffect(() => {
if (!getToken()) return;
return startAuthTokenAutoRefresh();
}, []);
if (!getToken()) return <Navigate to="/login" replace />;
return <Shell>{children}</Shell>;
}