feat: 本次提交更新内容如下

store 和 router 封装完毕
This commit is contained in:
笔记本里的永平
2025-07-17 22:19:37 +08:00
parent 6a4e99885d
commit 9d18af22f1
9 changed files with 137 additions and 14 deletions

View File

@@ -0,0 +1,2 @@
export * from './module/user';
// 未来可继续合并其他模块

View File

@@ -0,0 +1,20 @@
// src/store/user.ts
import { create } from 'zustand';
export interface User {
name: string;
role: string;
token: string;
}
interface UserState {
user: User | null;
setUser: (user: User) => void;
clearUser: () => void;
}
export const useUserStore = create<UserState>((set) => ({
user: null,
setUser: (user) => set({ user }),
clearUser: () => set({ user: null }),
}));