mirror of
https://github.com/Xevion/linkpulse.git
synced 2025-12-09 06:07:39 -06:00
Add zustand, true-myth, primitive authentication state, startup getSession()
This commit is contained in:
19
frontend/src/lib/state.ts
Normal file
19
frontend/src/lib/state.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { create } from "zustand";
|
||||
|
||||
type UserState = {
|
||||
user: {
|
||||
// TODO: This will eventually carry more user information (name, avatar, etc.)
|
||||
email: string;
|
||||
} | null;
|
||||
};
|
||||
|
||||
type UserActions = {
|
||||
setUser: (user: UserState["user"]) => void;
|
||||
logout: () => void;
|
||||
};
|
||||
|
||||
export const useUserStore = create<UserState & UserActions>((set) => ({
|
||||
user: null,
|
||||
setUser: (user) => set({ user }),
|
||||
logout: () => set({ user: null }),
|
||||
}));
|
||||
Reference in New Issue
Block a user