import { createClient } from 'better-call/client';

function createApiClient(options) {
  const { baseURL = "", basePath = "/" } = options ?? {};
  const normalizedBaseURL = baseURL ? baseURL.replace(/\/$/, "") : "";
  const normalizedBasePath = basePath.startsWith("/") ? basePath : `/${basePath}`;
  const finalBasePath = normalizedBasePath.replace(/\/$/, "");
  const apiPath = normalizedBaseURL + finalBasePath;
  return createClient({
    baseURL: apiPath
  });
}

export { createApiClient };
