Show WeCom machine name after brand title on shell and login.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user