diff --git a/front/src/App.tsx b/front/src/App.tsx
index 2b31d25..8c04d65 100644
--- a/front/src/App.tsx
+++ b/front/src/App.tsx
@@ -158,11 +158,13 @@ function App() {
const [identityDialogOpen, setIdentityDialogOpen] = useState(false);
const [identityToken, setIdentityToken] = useState('');
const [identityVisible, setIdentityVisible] = useState(false);
+ const [identityError, setIdentityError] = useState('');
useEffect(() => {
const handler = () => {
setIdentityToken(localStorage.getItem('identity_token') || '');
setIdentityVisible(false);
+ setIdentityError('');
setIdentityDialogOpen(true);
};
window.addEventListener('identity_invalid', handler as EventListener);
@@ -208,10 +210,17 @@ function App() {
disabled={!identityVisible}
onClick={() => {
if (!identityVisible || !identityToken) return;
- navigator.clipboard.writeText(identityToken).catch(() => {});
+ navigator.clipboard.writeText(identityToken).catch(() => {
+ setIdentityError('复制失败,请手动选择内容');
+ });
}}
/>
+ {identityError && (
+
+ {identityError}
+
+ )}
@@ -227,9 +236,11 @@ function App() {
try {
const token = await reset_identity_token();
setIdentityToken(token);
+ setIdentityError('');
setIdentityDialogOpen(false);
} catch (err) {
console.error('Failed to reset identity token:', err);
+ setIdentityError('重置失败,请稍后重试');
}
}}
>