How to use the strapi-helper-plugin.getYupInnerErrors function in strapi-helper-plugin

To help you get started, we’ve selected a few strapi-helper-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github strapi / strapi / packages / strapi-plugin-content-type-builder / admin / src / containers / FormModal / index.js View on Github external
// 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 = () => {
github strapi / strapi / packages / strapi-plugin-content-manager / admin / src / containers / EditView / index.js View on Github external
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,
    });
  };
github strapi / strapi / packages / strapi-plugin-settings-manager / admin / src / containers / ConfigPage / index.js View on Github external
{ 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,
      });
    }
  };
github strapi / strapi / packages / strapi-admin / admin / src / containers / AuthPage / index.js View on Github external
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,
    });
  };