Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dispatch({
type: 'GET_DATA_SUCCEEDED',
response,
});
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isLoading]);
const {
errors,
didCheckErrors,
initialData,
modifiedData,
} = reducerState.toJS();
const body = difference(modifiedData, initialData);
const handleSubmit = async e => {
e.preventDefault();
let formErrors = {};
const schema = forms[slug].schema;
try {
await schema.validate(modifiedData, { abortEarly: false });
if (!isEmpty(body)) {
try {
await request(
`/${pluginId}/${endPoint}`,
{ method: 'PUT', body, params: { source: 'db' } },
true
);
shouldComponentUpdate(prevProps) {
return !isEmpty(difference(prevProps, this.props));
}