feat: add xstate state management for user state

Introduce xstate v5 and @xstate/react to manage user authentication and profile state. Implement userMachine with actors for initialization, fetching, and logout operations, along with actions for updating user data and clearing state.
This commit is contained in:
2026-06-09 17:26:16 +08:00
parent 50940961ec
commit 5e645b003e
33 changed files with 1466 additions and 1273 deletions
+1 -1
View File
@@ -14,10 +14,10 @@
* - `clearAuthData` 顺序清理:loginToken → guestToken → refreshToken,任一失败立即返回
*/
import { LocalStorage } from "../local_storage";
import { Result, type Result as ResultT } from "@/utils/result";
import { StorageKeys } from "../storage_keys";
import type { IAuthStorage } from "./iauth_storage";
import { LocalStorage } from "@/utils/local-storage";
export class AuthStorage implements IAuthStorage {
private readonly ls: LocalStorage;