Fix validations for allready taken attributes

This commit is contained in:
soupette 2019-11-22 10:15:34 +01:00
parent 9237f6cf9d
commit c29212aa2c
2 changed files with 11 additions and 21 deletions

View File

@ -1,17 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<Loader /> should not crash 1`] = `
<div
className="sc-fYxtnH jGsbTZ"
>
<div
className="centered"
>
<div
className="sc-fMiknA iIEoBL"
>
<div />
</div>
</div>
</div>
`;

View File

@ -122,18 +122,25 @@ const FormModal = () => {
headerId = null;
}
console.log({ allDataSchema });
const checkFormValidity = async () => {
let schema;
if (state.modalType === 'contentType') {
schema = forms[state.modalType].schema(Object.keys(contentTypes));
} else if (
state.modalType === 'attribute' &&
state.forTarget !== 'components' &&
state.forTarget !== 'component'
state.modalType === 'attribute'
// && state.forTarget !== 'components' &&
// state.forTarget !== 'component'
) {
const pathToSchemaAttributes =
state.forTarget === 'contentType' || state.forTarget === 'component'
? [state.forTarget]
: [state.forTarget, state.targetUid];
schema = forms[state.modalType].schema(
allDataSchema,
get(allDataSchema, pathToSchemaAttributes, {}),
modifiedData.type,
modifiedData
);