import { create } from 'zustand';
import { devtools } from 'zustand/middleware';
import { apiMutate } from '../utilities/useAxiosMutate';
import { ConfigService } from '../configService';
export const useProductsStore = create()(devtools((set, get) => ({
    products: [],
    fetchedTenantId: null,
    fetchProducts: async (tenantId) => {
        if (get().fetchedTenantId === tenantId)
            return;
        set({ fetchedTenantId: tenantId });
        const response = await apiMutate(ConfigService.tenantV1ApiUrl, `tenants/products?tenantId=${tenantId}`, { method: 'GET' }, {});
        set({ products: response.data });
    },
})));
//# sourceMappingURL=productsStore.js.map