adminFront/src/stores/cart.ts
2023-03-06 16:22:12 +03:00

27 lines
680 B
TypeScript

import { create } from "zustand";
import { devtools, persist } from "zustand/middleware";
import { CartTotal } from "@root/model/cart";
interface CartStore {
cartTotal: CartTotal | null;
setCartTotal: (newCartTotal: CartTotal) => void;
}
export const useCartStore = create<CartStore>()(
devtools(
// persist(
(set, get) => ({
cartTotal: null,
setCartTotal: newCartTotal => set({ cartTotal: newCartTotal })
}),
// {
// name: "cart",
// getStorage: () => localStorage,
// }
// ),
{
name: "Cart store"
}
)
);