Modules: app/util/route-requirements/processRequirements

Methods


processRequirements(requirements, dispatch, getState, accountState, renderProps, callbacks)

Checks each of the given requirements to see if they are met, and calls their onFail handler otherwise. If any of the requirements fail, it will not process further requirements.

Parameters:
Name Type Description
requirements

An array of route requirements, as returned by the parseRouteRequirements util.

dispatch function

The redux dispatch function

getState function

The redux getState function

accountState
renderProps

The current render props returned by react-router

callbacks

An object containing callbacks that a RouteRequirement instance can execute in its onFail handler. Should include the following callbacks:

  • redirect(path) A function that will redirect to the given path
  • redirectToLogin() A function that will redirect to the login endpoint
Source:
Returns:

A promise that resolve with a boolean indicating if all requirements are met. If this is false, we should abort rendering of the current page.

Type
Promise