feat(auth): add startup auth status check with device id fallback

Add AuthStatusChecker mounted in RootProviders to dispatch AuthStatusCheckSubmitted on mount. The new checkAuthStatusActor retrieves the device id, checks for an existing login or guest token, and falls back to a guest login API call when neither is present. Wires the new event/actor through the auth machine to enable automatic session restoration and guest-mode bootstrap.
This commit is contained in:
2026-06-11 13:23:29 +08:00
parent 7c89f1b39d
commit 2475cb3e45
4 changed files with 92 additions and 3 deletions
+2
View File
@@ -13,6 +13,8 @@ export type AuthEvent =
| { type: "AuthModeChanged"; mode: AuthMode }
| { type: "AuthFormCleared" }
| { type: "AuthReset" }
/** 启动 / 恢复时检查登录态 —— 拿 deviceId → 查 token → 必要时游客登录 */
| { type: "AuthStatusCheckSubmitted" }
// 业务事件(提交)
| { type: "AuthEmailLoginSubmitted"; email: string; password: string }
| {