adminFront/src/stores/cart.ts

27 lines
689 B
TypeScript
Raw Normal View History

2023-02-18 13:59:36 +00:00
import create from "zustand";
import { devtools, persist } from "zustand/middleware";
import { ArrayProps } from "../model/tariff";
interface CartStore {
cartRowsData: Array<ArrayProps>,
setCartRowsData: (array: Array<ArrayProps>) => void,
}
export const useCartStore = create<CartStore>()(
devtools(
persist(
(set, get) => ({
cartRowsData: [],
setCartRowsData: (array: Array<ArrayProps>) => set({ cartRowsData: array }),
}),
{
name: "cart-storage",
getStorage: () => localStorage,
}
),
{
name: "Cart store"
}
)
);