Merge commit 'fcf1d45522e3ba6e6faf2590b60f2db1ef90e73c' into dev_jacy

This commit is contained in:
2026-07-07 13:55:10 +08:00
85 changed files with 11210 additions and 164 deletions
+9 -2
View File
@@ -8,6 +8,12 @@ import { normalizePhoneInput, validateMobilePhone } from '../lib/phone';
import { useSmsCode } from '../lib/use-sms-code';
import { isWechatEnv, weixinSdk } from '../lib/weixin';
import { useUserSession } from '../contexts/UserSessionContext';
import { touchPromoIfNeeded } from '../lib/promo';
async function finishLogin(navigate: (path: string) => void, returnTo: string) {
await touchPromoIfNeeded();
navigate(returnTo.startsWith('/') ? returnTo : '/');
}
export default function LoginPage() {
const navigate = useNavigate();
@@ -50,7 +56,8 @@ export default function LoginPage() {
phoneVerified: !!result.phoneVerified,
user: result.user as SessionPayload['user'],
});
navigate(returnTo.startsWith('/') ? returnTo : '/');
void finishLogin(navigate, returnTo);
return;
}
}
@@ -97,7 +104,7 @@ export default function LoginPage() {
body: JSON.stringify({ phone, code }),
});
applySession(data);
navigate(returnTo.startsWith('/') ? returnTo : '/');
await finishLogin(navigate, returnTo);
} catch (e) {
setMsg(e instanceof Error ? e.message : '登录失败');
} finally {