Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Search to open modal add fields for the main type (content type)
push({ search: '' });
}
} else {
console.error('This case is not handled');
}
return;
}
dispatch({
type: 'RESET_PROPS',
});
} catch (err) {
console.log({ err });
const errors = getYupInnerErrors(err);
dispatch({
type: 'SET_ERRORS',
errors,
});
}
};
const handleToggle = () => {
const checkFormErrors = async () => {
const schema = createYupSchema(layout, { groups: groupLayoutsData });
let errors = {};
try {
// Validate the form using yup
await schema.validate(modifiedData, { abortEarly: false });
} catch (err) {
errors = getYupInnerErrors(err);
}
dispatch({
type: 'SET_ERRORS',
errors,
});
};
{ method: 'PUT', body, params: { source: 'db' } },
true
);
emitEvent('willEditSettings', { category: endPoint });
dispatch({
type: 'SUBMIT_SUCCEEDED',
});
strapi.notification.success(
getTrad('strapi.notification.success.settingsEdit')
);
} catch (err) {
strapi.notification.error('notification.error');
}
}
} catch (err) {
formErrors = getYupInnerErrors(err);
strapi.notification.info('notification.form.error.fields');
} finally {
dispatch({
type: 'SET_ERRORS',
errors: formErrors,
});
}
};
if (authType === 'login') {
formErrors = {
global: formattedError,
identifier: formattedError,
password: formattedError,
};
} else if (authType === 'forgot-password') {
formErrors = { email: formattedError };
} else {
strapi.notification.error(
get(formattedError, '0.id', 'notification.error')
);
}
}
} catch (err) {
formErrors = getYupInnerErrors(err);
}
dispatch({
type: 'SET_ERRORS',
formErrors,
});
};