27 lines
689 B
TypeScript
27 lines
689 B
TypeScript
![]() |
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"
|
||
|
}
|
||
|
)
|
||
|
);
|