feat(fullstack): Add test application form creation
This commit is contained in:
24
legalconsenthub/app/composables/testing/useTestDataApi.ts
Normal file
24
legalconsenthub/app/composables/testing/useTestDataApi.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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<ApplicationFormDto> {
|
||||
return testDataApiClient.createTestDataApplicationForm({ organizationId })
|
||||
}
|
||||
|
||||
return {
|
||||
createTestDataApplicationForm
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user