adminFront/src/stores/tariffs.ts
2023-02-18 16:59:36 +03:00

31 lines
950 B
TypeScript

import create from "zustand";
import { devtools, persist } from "zustand/middleware";
import { ArrayProps } from "../model/tariff";
interface TariffStore {
tariffs: Array<ArrayProps>;
setTariffs: (array: Array<ArrayProps>) => void;
tariffsSelectedRowsData: Array<ArrayProps>;
setTariffsSelectedRowsData: (array: Array<ArrayProps>) => void;
}
export const useTariffStore = create<TariffStore>()(
devtools(
persist(
(set, get) => ({
tariffs: [],
setTariffs: (array: Array<ArrayProps>) => set({ tariffs: array }),
tariffsSelectedRowsData: [],
setTariffsSelectedRowsData: (array: Array<ArrayProps>) => set({ tariffsSelectedRowsData: array }),
}),
{
name: "tariff-storage",
getStorage: () => localStorage,
}
),
{
name: "Tariff store"
}
)
);