Setting required requests

It is possible to finish webapps flow and not call any API requests if some fields are somehow skipped or forgotten about. With required requests guard, it is possible to defined requests that need to be fired before user opens certain screen.

Usage

In flow screen add required_requests parameter. It's an array of strings | JsonLogic that represents names of requests that should be called when reached this screen.

If API request was not made it will throw error and user will be presented with a generic error message and we'll be notified by Bugsnag, that this situation occurred.

Example:

{
  // ...
  "flow": [
    {
      "path": "first",
      "required_requests": [
        "quote"
      ],
      "components": []
    },
    {
      "path": "success",
      "required_requests": [
        "policy"
      ],
      "components": []
    }
  ]
}

It is possible to define logic for required requests, for example if some requests should be fired when some input value is set.

{
  // ...
  "flow": [
    {
      "path": "success",
      "required_requests": [
        "policy",
        "quote",
        {
          "type": "jsonlogic",
          "schema": {
            "if": [
              {
                "var": "input.save_for_later"
              },
              "lead"
            ]
          }
        }
      ],
      "components": []
    }
  ]
}

Last updated