22 lines
494 B
TypeScript
22 lines
494 B
TypeScript
import { create } from 'zustand';
|
|
|
|
interface Product {
|
|
id: number;
|
|
name: string;
|
|
image: string;
|
|
inStock: boolean;
|
|
}
|
|
|
|
interface PriceModalStore {
|
|
isOpen: boolean;
|
|
product: Product | null;
|
|
openModal: (product: Product) => void;
|
|
closeModal: () => void;
|
|
}
|
|
|
|
export const usePriceModalStore = create<PriceModalStore>((set) => ({
|
|
isOpen: false,
|
|
product: null,
|
|
openModal: (product) => set({ isOpen: true, product }),
|
|
closeModal: () => set({ isOpen: false, product: null }),
|
|
})); |