feat: add stores
This commit is contained in:
18
client/src/store/authStore.ts
Normal file
18
client/src/store/authStore.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { create } from 'zustand';
|
||||
import { devtools } from 'zustand/middleware';
|
||||
|
||||
type AuthState = {
|
||||
accessToken: string | null;
|
||||
setAccessToken: (token: string | null) => void;
|
||||
};
|
||||
|
||||
export const useAuthStore = create<AuthState>()(
|
||||
devtools((set) => ({
|
||||
accessToken: null,
|
||||
setAccessToken: (token) => set({ accessToken: token }),
|
||||
}))
|
||||
);
|
||||
|
||||
export const useAuthSelector = () => {
|
||||
return useAuthStore((state) => state.accessToken);
|
||||
};
|
Reference in New Issue
Block a user