feat(settings): 集中刷新策略与账号授权并独立设置审计
build / build (push) Successful in 1m11s

This commit is contained in:
姚章浩
2026-10-27 09:28:16 +08:00
parent a55d7f454e
commit 8930ef29cd
8 changed files with 520 additions and 214 deletions
+3 -2
View File
@@ -10,6 +10,7 @@ import type { DingtalkSessionView } from './dingtalkSession'
const finished = new Set(['success', 'expired', 'failed', 'closed'])
interface DingtalkSessionControlProps {
triggerLabel?: string
autoStart?: boolean
hideTrigger?: boolean
space?: string
@@ -17,7 +18,7 @@ interface DingtalkSessionControlProps {
onClose?: () => void
}
export function DingtalkSessionControl({ autoStart = false, hideTrigger = false, space, onSuccess, onClose }: DingtalkSessionControlProps = {}) {
export function DingtalkSessionControl({ autoStart = false, hideTrigger = false, space, onSuccess, onClose, triggerLabel = '扫码刷新会话' }: DingtalkSessionControlProps = {}) {
const [session, setSession] = useState<DingtalkSessionView | null>(null)
const [failure, setFailure] = useState<string | null>(null)
const [starting, setStarting] = useState(false)
@@ -89,7 +90,7 @@ export function DingtalkSessionControl({ autoStart = false, hideTrigger = false,
return <div className="dingtalk-session-control">
{!hideTrigger ? <button className="secondary" disabled={starting || (session ? !finished.has(session.state) : false)} onClick={() => void start()}>
{session && !finished.has(session.state) ? '扫码进行中…' : '扫码刷新会话'}
{session && !finished.has(session.state) ? '扫码进行中…' : triggerLabel}
</button> : null}
{lastSuccess && !hideTrigger ? <p className="success-message" role="status">✅ 钉钉会话已刷新</p> : null}
{failure && !open ? <p className="error-message" role="alert">{failure}</p> : null}