mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 15:44:28 +00:00
refactor(monorepo): decouple api and webui into workspaces packages
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { create } from 'zustand'
|
||||
import { persist, createJSONStorage } from 'zustand/middleware'
|
||||
|
||||
interface AuthState {
|
||||
user: unknown | null
|
||||
setUser: (user: unknown) => void
|
||||
clearAuth: () => void
|
||||
}
|
||||
|
||||
export const useAuthStore = create<AuthState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
user: null,
|
||||
setUser: (user) => set({ user }),
|
||||
clearAuth: () => set({ user: null }),
|
||||
}),
|
||||
{
|
||||
name: 'auth-storage',
|
||||
storage: createJSONStorage(() => localStorage),
|
||||
},
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user