Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

476 B
Raw Blame
import { CartloomAuthType } from './auth';
import { getProducts } from './api';

export async function buildProductsDropdown(auth: CartloomAuthType) {
  if (!auth) {
    return {
      options: [],
      disabled: true,
      placeholder: 'Please authenticate first',
    };
  }
  const response = await getProducts(auth);
  const options = response.data.map((product) => {
    return { label: product.name, value: product.pid };
  });
  return {
    options: options,
  };
}