diff --git a/src/frontend/src/api/CreateProjectService.ts b/src/frontend/src/api/CreateProjectService.ts index a6ea36d25..03d3f1eaa 100755 --- a/src/frontend/src/api/CreateProjectService.ts +++ b/src/frontend/src/api/CreateProjectService.ts @@ -190,18 +190,31 @@ const GenerateProjectFilesService = (url: string, projectData: any, formUpload: let isAPISuccess = true; try { let response; - + const additional_entities: string[] = + projectData?.additional_entities?.length > 0 ? [projectData?.additional_entities?.[0].replace(' ', '_')] : []; if (projectData.form_ways === 'custom_form') { // TODO move form upload to a separate service / endpoint? const generateApiFormData = new FormData(); generateApiFormData.append('xlsform', formUpload); + if (additional_entities?.length > 0) { + generateApiFormData.append('additional_entities', additional_entities); + } response = await axios.post(url, generateApiFormData, { headers: { 'Content-Type': 'multipart/form-data', }, }); } else { - response = await axios.post(url, {}); + const generateApiFormData = new FormData(); + generateApiFormData.append( + 'additional_entities', + additional_entities?.length > 0 ? additional_entities : null, + ); + response = await axios.post(url, generateApiFormData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); } isAPISuccess = isStatusSuccess(response.status); if (!isAPISuccess) {