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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user