Describes the settings to connect the Web API.

interface ReportServiceSettings {
    onRequest?: Function;
    onRequestAsync?: ((init) => Promise<RequestInit>);
    securityToken?: string;
    url?: string;
}

Properties

onRequest?: Function

Callback before any request. Allows to change RequestInit object before fetch request - https://fetch.spec.whatwg.org/#requestinit.

Example: Usage example:

onRequest: (init) => init.headers.Authorization = 'security_token';
onRequestAsync?: ((init) => Promise<RequestInit>)

Callback before any request. Allows to change RequestInit object before fetch request - https://fetch.spec.whatwg.org/#requestinit.

Type declaration

    • (init): Promise<RequestInit>
    • Parameters

      • init: RequestInit

      Returns Promise<RequestInit>

Example: Usage example:

onRequestAsync: (init) => {
return new Promise((resolve, reject) => {
init.headers.Authorization = 'security_token';
return resolve(init);
});
securityToken?: string

The security key needed to access the Web API.

Example: Usage example:

securityToken: 'security_token',
url?: string

The url to connect the Web API.

Example: Usage example (prefix only):

url: '/api/reporting' // default value

Example: Usage example (full URL):

url: 'http:example.com/api/reporting'