createJsonQuery
Formulae
createJsonQuery(config)
Config fields:
params?
: parameters for the QueryinitialData?
: initial data of the Query, will be passed to the$data
store as an initial valuerequest
: declarative rules to formulate request to the API.method
: Stringurl
: Sourced stringbody
: Sourced Json, any value which can be serialized to JSON and parsed back without loses by JavaScript native module JSON. For example,{ a: 1, b: 2 }
. Note that body cannot be used inGET
andHEAD
requests.query?
: Sourced object, keys of the object must beString
and values must beString
orArray<String>
or (since v0.8.0) Sourced String containing ready-to-use query stringheaders?
: Sourced object, keys of the object must beString
and values must beString
orArray<String>
response
: declarative rules to handle response from the API.contract
: Contract allows you to validate the response and decide how your application should treat it — as a success response or as a failed one.validate?
: Validator allows you to dynamically validate received data.mapData?
: optional mapper for the response data, available overloads:({ result, params }) => mapped
{ source: Store, fn: (data, { result, params }) => mapped }
concurrency?
: concurrency settings for the Querystrategy?
: available values:TAKE_EVERY
execute every requestTAKE_FIRST
skip all requests if there is a pending oneTAKE_LATEST
(default value) cancel all pending requests and execute the latest one
abort?
: Event after calling which all in-flight requests will be aborted