This commit is contained in:
elforjani3
2021-07-31 13:40:16 +02:00
parent 720dc5b7d7
commit 7582954337

View File

@@ -9,10 +9,10 @@ import { transformToForm } from 'utils';
import { import {
CreateItemCategoryFormSchema, CreateItemCategoryFormSchema,
EditItemCategoryFormSchema, EditItemCategoryFormSchema,
} from './ItemCategoryForm.schema'; } from './itemCategoryForm.schema';
import withDialogActions from 'containers/Dialog/withDialogActions'; import withDialogActions from 'containers/Dialog/withDialogActions';
import ItemCategoryFormContent from './ItemCategoryFormContent' import ItemCategoryFormContent from './ItemCategoryFormContent';
import { compose } from 'utils'; import { compose } from 'utils';
const defaultInitialValues = { const defaultInitialValues = {
@@ -30,7 +30,6 @@ function ItemCategoryForm({
// #withDialogActions // #withDialogActions
closeDialog, closeDialog,
}) { }) {
const { const {
isNewMode, isNewMode,
itemCategory, itemCategory,
@@ -81,7 +80,11 @@ function ItemCategoryForm({
}; };
// Handle the response error. // Handle the response error.
const onError = (error) => { const onError = (error) => {
const { response: { data: { errors } } } = error; const {
response: {
data: { errors },
},
} = error;
transformErrors(errors, { setErrors }); transformErrors(errors, { setErrors });
setSubmitting(false); setSubmitting(false);
@@ -108,6 +111,4 @@ function ItemCategoryForm({
); );
} }
export default compose( export default compose(withDialogActions)(ItemCategoryForm);
withDialogActions,
)(ItemCategoryForm);