feat: 实现前端管理后台(React + Vite + Ant Design + Zustand)

This commit is contained in:
2026-06-29 17:46:41 +06:00
parent da06866360
commit c714ea95ac
21 changed files with 1193 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
import { create } from 'zustand';
import { persist } from 'zustand/middleware';
export interface User {
id: string;
username: string;
role: 'admin' | 'readonly';
}
interface AuthState {
token: string | null;
user: User | null;
setAuth: (token: string, user: User) => void;
clearAuth: () => void;
}
export const useAuthStore = create<AuthState>()(
persist(
(set) => ({
token: null,
user: null,
setAuth: (token, user) => set({ token, user }),
clearAuth: () => set({ token: null, user: null }),
}),
{ name: 'vod-auth' }
)
);