🖼️
KASKO Frontend Documentation
  • README
  • Getting started
    • Setting up a new webapp
    • Webapp manifest
    • Building the flow
    • Defining layouts
    • Defining computed values
    • Defining dynamic paths
  • Core concepts
    • Forms
    • Validation
      • Using existing validators
      • Adding custom validators
    • Configuration
      • Price format
      • Date format
    • Performing API calls
    • Toggling visibility of components
    • Translations
    • Rules For Robust Application
  • Guides
    • Using logical statements (JsonLogic)
    • Adding discount codes
    • Developing Custom Plugins
    • Setting required requests
    • Adding save quote for later
    • Transforming request data
    • Manifest merging strategy
    • Knockout flow
    • Local pricing logic
    • Setting up dashboard policy profile
    • Handling offers
    • Repeater
  • Snippets
    • Reset input state
  • Useful resources
    • All component descriptions
    • JsonLogic core documentation
    • Kasko.js documentation
    • Example webapp
    • Example plugins (w/ various frameworks)
Powered by GitBook
On this page
  1. Guides

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 1 year ago