ConfigAndCallbacks

Set caching option, callbacks, and data formatting function when querying data from Airstack API.

Example

{
  "cache": true,
  "onCompleted": (data) => {},
  "onError": (error) => {},
  "dataFormatter": (data) => {}
}

Type Signature

type ConfigAndCallbacks = {
  cache?: boolean;
  onCompleted?: (data: any) => void;
  onError?: (error: any) => void;
  dataFormatter?: any;
}

Fields

ParamTypeDefault ValueDescription

cache

boolean

true

Caching configuration. true to cache results, otherwise set to false.

onCompleted

(data: any) => void

-

A callback function that will be called when the query is successfully completed.

onError

(error: any) => void

-

A callback function that will be called when an error occurs during the query.

dataFormatter

(data: any) => any

-

A function that allows custom formatting of the data before returning it to the user.

Last updated

Was this helpful?