import { TestDataApi, Configuration, type ApplicationFormDto } from '~~/.api-client' import { cleanDoubleSlashes, withoutTrailingSlash } from 'ufo' import { wrappedFetchWrap } from '~/utils/wrappedFetch' export function useTestDataApi() { const appBaseUrl = useRuntimeConfig().app.baseURL const { serverApiBasePath, clientProxyBasePath } = useRuntimeConfig().public const basePath = withoutTrailingSlash( cleanDoubleSlashes(import.meta.client ? appBaseUrl + clientProxyBasePath : clientProxyBasePath + serverApiBasePath) ) const testDataApiClient = new TestDataApi( new Configuration({ basePath, fetchApi: wrappedFetchWrap(useRequestFetch()) }) ) async function createTestDataApplicationForm(organizationId: string): Promise { return testDataApiClient.createTestDataApplicationForm({ organizationId }) } return { createTestDataApplicationForm } }