Skip to content

Commit

Permalink
fix: dont send block names and input levels if use fields from parent…
Browse files Browse the repository at this point in the history
… is checked
  • Loading branch information
g-saracca committed Nov 1, 2024
1 parent f9bda33 commit c379d50
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
CollectionFormData,
CollectionFormValuesOnSubmit,
INPUT_LEVELS_GROUPER,
METADATA_BLOCKS_NAMES_GROUPER
METADATA_BLOCKS_NAMES_GROUPER,
USE_FIELDS_FROM_PARENT
} from './CollectionForm'
import { RouteWithParams } from '../../Route.enum'
import { JSDataverseWriteErrorHandler } from '../../../shared/helpers/JSDataverseWriteErrorHandler'
Expand Down Expand Up @@ -65,15 +66,17 @@ export function useSubmitCollection(

const facetIdsDTO = formData.facetIds.map((facet) => facet.value)

const useFieldsFromParentChecked = formData[USE_FIELDS_FROM_PARENT]

const newCollection: CollectionDTO = {
name: formData.name,
alias: formData.alias,
type: formData.type,
affiliation: formData.affiliation,
description: formData.description,
contacts: contactsDTO,
metadataBlockNames: metadataBlockNamesDTO,
inputLevels: inputLevelsDTO,
metadataBlockNames: useFieldsFromParentChecked ? undefined : metadataBlockNamesDTO,
inputLevels: useFieldsFromParentChecked ? undefined : inputLevelsDTO,
facetIds: facetIdsDTO
}

Expand Down

0 comments on commit c379d50

Please sign in to comment.