@itcase/forms 1.1.38 → 1.1.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2593,6 +2593,9 @@ const setErrorsMutator = (args, state) => {
2593
2593
  // state.formState.valid = false
2594
2594
  state.formState.error = fieldError;
2595
2595
  state.formState.submitError = submitError;
2596
+ console.log('non_field_errors');
2597
+ console.log(data);
2598
+ console.log('non_field_errors');
2596
2599
  } else if (fieldName in state.fields) {
2597
2600
  if (fieldError) {
2598
2601
  const errorsState = Object.assign({}, state.formState.errors, {
@@ -2639,9 +2642,9 @@ const sendFormDataToServer = async (url, data) => {
2639
2642
  });
2640
2643
  }
2641
2644
  return {
2645
+ error,
2642
2646
  success: false,
2643
- formErrors,
2644
- error
2647
+ formErrors
2645
2648
  };
2646
2649
  }
2647
2650
  };
@@ -2736,7 +2739,6 @@ const FinalForm = /*#__PURE__*/React__default.default.forwardRef(function FinalF
2736
2739
  onChangeFormValues,
2737
2740
  onSubmit
2738
2741
  } = props;
2739
- console.log(buttonJustifyContent);
2740
2742
  const validate = useYupValidationSchema(validationSchema, language);
2741
2743
  const onRefFormInstance = React.useCallback(formInstance => {
2742
2744
  if (ref) {
@@ -3109,7 +3111,7 @@ const getErrorsForFinalForm = error => {
3109
3111
  */
3110
3112
 
3111
3113
  const formErrors = {};
3112
- const serverErrors = error.response?.data;
3114
+ const serverErrors = error.response?.data || error;
3113
3115
  if (serverErrors) {
3114
3116
  // Collect errors for some fields, which in the response from server
3115
3117
  if (typeof serverErrors === 'string') {
@@ -2582,6 +2582,9 @@ const setErrorsMutator = (args, state) => {
2582
2582
  // state.formState.valid = false
2583
2583
  state.formState.error = fieldError;
2584
2584
  state.formState.submitError = submitError;
2585
+ console.log('non_field_errors');
2586
+ console.log(data);
2587
+ console.log('non_field_errors');
2585
2588
  } else if (fieldName in state.fields) {
2586
2589
  if (fieldError) {
2587
2590
  const errorsState = Object.assign({}, state.formState.errors, {
@@ -2628,9 +2631,9 @@ const sendFormDataToServer = async (url, data) => {
2628
2631
  });
2629
2632
  }
2630
2633
  return {
2634
+ error,
2631
2635
  success: false,
2632
- formErrors,
2633
- error
2636
+ formErrors
2634
2637
  };
2635
2638
  }
2636
2639
  };
@@ -2725,7 +2728,6 @@ const FinalForm = /*#__PURE__*/React.forwardRef(function FinalForm(props, ref) {
2725
2728
  onChangeFormValues,
2726
2729
  onSubmit
2727
2730
  } = props;
2728
- console.log(buttonJustifyContent);
2729
2731
  const validate = useYupValidationSchema(validationSchema, language);
2730
2732
  const onRefFormInstance = useCallback(formInstance => {
2731
2733
  if (ref) {
@@ -3098,7 +3100,7 @@ const getErrorsForFinalForm = error => {
3098
3100
  */
3099
3101
 
3100
3102
  const formErrors = {};
3101
- const serverErrors = error.response?.data;
3103
+ const serverErrors = error.response?.data || error;
3102
3104
  if (serverErrors) {
3103
3105
  // Collect errors for some fields, which in the response from server
3104
3106
  if (typeof serverErrors === 'string') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/forms",
3
- "version": "1.1.38",
3
+ "version": "1.1.39",
4
4
  "description": "Forms fields, inputs, etc.",
5
5
  "keywords": [],
6
6
  "license": "MIT",