feat(frontend): polish login and design tokens
This commit is contained in:
@@ -384,14 +384,16 @@ export function App() {
|
||||
}, "图片已生成");
|
||||
}
|
||||
|
||||
function onAuthed(payload: { token: string; user: User; team: Team }) {
|
||||
async function onAuthed(payload: { token: string; user: User; team: Team }) {
|
||||
setToken(payload.token);
|
||||
setUser(payload.user);
|
||||
setTeam(payload.team);
|
||||
setBooting(false);
|
||||
setAuthed(true);
|
||||
setBooting(true);
|
||||
loadData().finally(() => setBooting(false));
|
||||
navigate("dashboard", { replace: true });
|
||||
void loadData().catch((error) => {
|
||||
console.error("[login] data hydrate failed:", error);
|
||||
});
|
||||
}
|
||||
|
||||
async function logout() {
|
||||
@@ -411,7 +413,7 @@ export function App() {
|
||||
initialMode={authMode}
|
||||
onModeChange={(next) => {
|
||||
setAuthMode(next);
|
||||
window.history.pushState(null, "", next === "register" ? "/register" : "/login");
|
||||
window.history.pushState(null, "", "/login");
|
||||
}}
|
||||
onAuthed={onAuthed}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user