How to use the @commercetools-frontend/actions-global.handleActionError function in @commercetools-frontend/actions-global

To help you get started, weā€™ve selected a few @commercetools-frontend/actions-global 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 commercetools / merchant-center-application-kit / packages / application-shell / src / components / handle-apollo-errors / handle-apollo-errors.js View on Github external
// If an error has been dispatched already, we don't do anything else.
          // If an error has been dispatched already but the query does not contain an error anymore,
          // we remove the entry from the dispatchedErrors map.
          // If an error has not been dispatched yet, we keep track of it and we dispatch it.
          const queryResult = this.props[name];
          if (queryResult) {
            const hasPreviouslyDispatchedError = Boolean(
              this.dispatchedErrors.get(name)
            );
            const hasQueryErrored = Boolean(queryResult.error);
            if (hasPreviouslyDispatchedError && !hasQueryErrored) {
              this.dispatchedErrors.delete(name);
            }
            if (!hasPreviouslyDispatchedError && hasQueryErrored) {
              this.dispatchedErrors.set(name, queryResult.error);
              this.context.store.dispatch(handleActionError(queryResult.error));
            }
          }
        });
      }
github commercetools / merchant-center-application-kit / playground / src / components / entry-point / entry-point.js View on Github external
Sdk.Get.errorHandler = error =>
            globalActions.handleActionError(error, 'sdk')(dispatch);
        }}