feat(#12): Add subsections to sections, fix version deletion after update
This commit is contained in:
@@ -76,25 +76,25 @@ export function useApplicationForm() {
|
||||
}
|
||||
}
|
||||
|
||||
async function addFormElementToSection(
|
||||
async function addFormElementToSubSection(
|
||||
applicationFormId: string,
|
||||
sectionId: string,
|
||||
subsectionId: string,
|
||||
createFormElementDto: CreateFormElementDto,
|
||||
position: number
|
||||
): Promise<ApplicationFormDto> {
|
||||
if (!applicationFormId || !sectionId) {
|
||||
return Promise.reject(new Error('Application form ID or section ID missing'))
|
||||
if (!applicationFormId || !subsectionId) {
|
||||
return Promise.reject(new Error('Application form ID or subsection ID missing'))
|
||||
}
|
||||
|
||||
try {
|
||||
return await applicationFormApi.addFormElementToSection(
|
||||
return await applicationFormApi.addFormElementToSubSection(
|
||||
applicationFormId,
|
||||
sectionId,
|
||||
subsectionId,
|
||||
createFormElementDto,
|
||||
position
|
||||
)
|
||||
} catch (e: unknown) {
|
||||
console.error(`Failed adding form element to section ${sectionId}:`, e)
|
||||
console.error(`Failed adding form element to subsection ${subsectionId}:`, e)
|
||||
return Promise.reject(e)
|
||||
}
|
||||
}
|
||||
@@ -106,6 +106,6 @@ export function useApplicationForm() {
|
||||
updateApplicationForm,
|
||||
deleteApplicationFormById,
|
||||
submitApplicationForm,
|
||||
addFormElementToSection
|
||||
addFormElementToSubSection
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,15 +54,15 @@ export function useApplicationFormApi() {
|
||||
return applicationFormApiClient.submitApplicationForm({ id })
|
||||
}
|
||||
|
||||
async function addFormElementToSection(
|
||||
async function addFormElementToSubSection(
|
||||
applicationFormId: string,
|
||||
sectionId: string,
|
||||
subsectionId: string,
|
||||
createFormElementDto: CreateFormElementDto,
|
||||
position: number
|
||||
): Promise<ApplicationFormDto> {
|
||||
return applicationFormApiClient.addFormElementToSection({
|
||||
return applicationFormApiClient.addFormElementToSubSection({
|
||||
applicationFormId,
|
||||
sectionId,
|
||||
subsectionId,
|
||||
createFormElementDto,
|
||||
position
|
||||
})
|
||||
@@ -75,6 +75,6 @@ export function useApplicationFormApi() {
|
||||
updateApplicationForm,
|
||||
deleteApplicationFormById,
|
||||
submitApplicationForm,
|
||||
addFormElementToSection
|
||||
addFormElementToSubSection
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user