sushilideaclan01's picture
Initial commit of the Ad Generator Lite project, including backend services, frontend components, and configuration files. Added core functionalities for ad generation, user management, and image processing, along with a structured matrix system for ad testing.
f201243
raw
history blame contribute delete
770 Bytes
import { create } from "zustand";
import { persist } from "zustand/middleware";
interface AuthState {
isAuthenticated: boolean;
token: string | null;
user: { username: string } | null;
login: (token: string, username: string) => void;
logout: () => void;
}
export const useAuthStore = create<AuthState>()(
persist(
(set) => ({
isAuthenticated: false,
token: null,
user: null,
login: (token: string, username: string) => {
set({
isAuthenticated: true,
token,
user: { username },
});
},
logout: () => {
set({
isAuthenticated: false,
token: null,
user: null,
});
},
}),
{
name: "auth-storage",
}
)
);