初始化项目
This commit is contained in:
19
src/store/auth.ts
Normal file
19
src/store/auth.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { create } from 'zustand'
|
||||
import { persist } from 'zustand/middleware'
|
||||
|
||||
interface AuthState {
|
||||
isAuthenticated: boolean
|
||||
setAuth: (state: boolean) => void
|
||||
}
|
||||
|
||||
export const useAuthStore = create<AuthState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
isAuthenticated: false,
|
||||
setAuth: (state) => set({ isAuthenticated: state }),
|
||||
}),
|
||||
{
|
||||
name: 'auth-storage',
|
||||
}
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user