front-hub/src/stores/discounts.ts

23 lines
552 B
TypeScript
Raw Normal View History

import { Discount } from "@frontend/kitui";
2023-06-16 20:09:56 +00:00
import { create } from "zustand";
import { devtools } from "zustand/middleware";
2023-07-10 20:22:06 +00:00
interface DiscountStore {
discounts: Discount[];
2023-06-16 20:09:56 +00:00
}
2023-07-10 20:22:06 +00:00
export const useDiscountStore = create<DiscountStore>()(
2023-06-16 20:09:56 +00:00
devtools(
(set, get) => ({
2023-07-09 23:04:23 +00:00
discounts: []
2023-06-16 20:09:56 +00:00
}),
{
2023-06-30 15:28:10 +00:00
name: "Discounts",
2023-06-16 20:09:56 +00:00
enabled: process.env.NODE_ENV === "development",
}
)
);
export const setDiscounts = (discounts: DiscountStore["discounts"]) => useDiscountStore.setState({ discounts });