短信验证调试成功

This commit is contained in:
2026-07-06 13:18:56 +08:00
parent 5ba69eb935
commit 1c978b8adc
62 changed files with 2491 additions and 354 deletions
@@ -13,6 +13,7 @@ import {
ensureSession,
getDeviceKey,
request,
saveSession,
type SessionPayload,
type UserProfile,
} from '../lib/api';
@@ -21,6 +22,7 @@ type UserSessionContextValue = {
ready: boolean;
profile: UserProfile | null;
phoneVerified: boolean;
applySession: (session: SessionPayload) => void;
refreshProfile: () => Promise<void>;
resetSession: () => Promise<void>;
};
@@ -33,6 +35,7 @@ export function UserSessionProvider({ children }: { children: ReactNode }) {
const [phoneVerified, setPhoneVerified] = useState(false);
const applySession = useCallback((session: SessionPayload) => {
saveSession(session);
if (session.user) setProfile(session.user);
setPhoneVerified(!!session.phoneVerified || !!session.user?.phoneVerified);
}, []);
@@ -83,10 +86,11 @@ export function UserSessionProvider({ children }: { children: ReactNode }) {
ready,
profile,
phoneVerified,
applySession,
refreshProfile,
resetSession,
}),
[ready, profile, phoneVerified, refreshProfile, resetSession],
[ready, profile, phoneVerified, applySession, refreshProfile, resetSession],
);
if (!ready) {