2388873e7a
- Fix duplicate 'signature' variable in webhooks.ts - Add Prisma binary target for Alpine Linux - Fix tsconfig path alias (@/* -> ./src/*) - Add missing next-themes dependency - Add build args for NEXT_PUBLIC_* env vars - Fix SSR issues with zustand and providers - Add providers-wrapper with dynamic ssr:false import - Add SSL certs and public dir for nginx - Update Dockerfiles for proper Prisma engine handling
33 lines
742 B
TypeScript
33 lines
742 B
TypeScript
import { create } from 'zustand';
|
|
|
|
export interface User {
|
|
id: string;
|
|
plexId: string;
|
|
plexUsername: string;
|
|
email: string | null;
|
|
isAdmin: boolean;
|
|
walletAddress: string | null;
|
|
totalEarned: number;
|
|
totalSpent: number;
|
|
}
|
|
|
|
interface AppState {
|
|
user: User | null;
|
|
token: string | null;
|
|
isAuthenticated: boolean;
|
|
setUser: (user: User | null) => void;
|
|
setToken: (token: string | null) => void;
|
|
logout: () => void;
|
|
}
|
|
|
|
export const useStore = create<AppState>()((set) => ({
|
|
user: null,
|
|
token: null,
|
|
isAuthenticated: false,
|
|
setUser: (user) => set({ user, isAuthenticated: !!user }),
|
|
setToken: (token) => set({ token }),
|
|
logout: () => {
|
|
set({ user: null, token: null, isAuthenticated: false });
|
|
},
|
|
}));
|