Show WeCom machine name after brand title on shell and login.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-02 11:43:02 +08:00
parent 9427d9c429
commit ead3545df8
5 changed files with 72 additions and 5 deletions
+18 -2
View File
@@ -1,6 +1,6 @@
import { FormEvent, useEffect, useState } from "react";
import { useNavigate, useSearchParams } from "react-router-dom";
import { login, setSession } from "../api/client";
import { fetchMachineName, login, setSession } from "../api/client";
type ExchangeRes = {
token: string;
@@ -16,6 +16,17 @@ export default function LoginPage() {
const [err, setErr] = useState("");
const [loading, setLoading] = useState(false);
const [ticketBusy, setTicketBusy] = useState(false);
const [machineName, setMachineName] = useState("");
useEffect(() => {
let cancelled = false;
void fetchMachineName().then((name) => {
if (!cancelled) setMachineName(name);
});
return () => {
cancelled = true;
};
}, []);
useEffect(() => {
const ticket = (params.get("ticket") || "").trim();
@@ -91,7 +102,12 @@ export default function LoginPage() {
width={48}
height={48}
/>
<h1></h1>
<h1>
{machineName ? (
<span className="brand-machine">{machineName}</span>
) : null}
</h1>
</div>
{err ? <div className="err">{err}</div> : null}
<div className="field">