How to use the strapi-helper-plugin.difference 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-settings-manager / admin / src / containers / ConfigPage / index.js View on Github external
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
          );
github strapi / strapi / packages / strapi-admin / admin / src / containers / Admin / index.js View on Github external
shouldComponentUpdate(prevProps) {
    return !isEmpty(difference(prevProps, this.props));
  }