import create from "zustand"; import { devtools, persist } from "zustand/middleware"; import { Promocode } from "../model/cart"; import { testPromocodes } from "./mocks/promocodes"; interface PromocodeStore { promocodeArray: Array, setPromocodeArray: (array: Array) => void, } export const usePromocodeStore = create()( devtools( persist( (set, get) => ({ promocodeArray: testPromocodes, setPromocodeArray: (array: Array) => set({ promocodeArray: array }), }), { name: "promocode-storage", getStorage: () => localStorage, } ), { name: "Promocode store" } ) );