import { ConfigService } from "../configService/index.mjs";
import { apiMutate } from "../utilities/useAxiosMutate.mjs";
import { create } from "zustand";
import { devtools } from "zustand/middleware";
//#region src/stores/productsStore.ts
const useProductsStore = create()(devtools((set, get) => ({
	products: [],
	fetchedTenantId: null,
	fetchProducts: async (tenantId) => {
		if (get().fetchedTenantId === tenantId) return;
		set({ fetchedTenantId: tenantId });
		set({ products: (await apiMutate(ConfigService.tenantV1ApiUrl, `tenants/products?tenantId=${tenantId}`, { method: "GET" }, {})).data });
	}
})));
//#endregion
export { useProductsStore };

//# sourceMappingURL=productsStore.mjs.map