31 lines
950 B
TypeScript
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"
|
||
|
}
|
||
|
)
|
||
|
);
|