A global mixin object containing common API calls
- Source:
Methods
(method) api(axios, url, options, cache) → {Promise.<any>}
Makes an API request using Axios.
Parameters:
Name | Type | Description |
---|---|---|
axios |
AxiosInstance | The Axios instance to use for the request. |
url |
string | The URL to make the request to. |
options |
object | The options to pass to the Axios request. |
cache |
boolean | Indicates whether to cache the response. |
- Source:
Returns:
- A promise that resolves to the response data.
- Type
- Promise.<any>
(method) apiArray(name, axios, url, options, cache) → {Promise.<void>}
Fetches data from an API and stores it in the store if it is not already present.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the store property to store the data. |
axios |
object | The Axios instance used for making API requests. |
url |
string | The URL of the API endpoint. |
options |
object | The options object to be passed to the Axios request. |
cache |
boolean | Indicates whether the response should be cached. |
- Source:
Returns:
- A Promise that resolves when the API request is complete.
- Type
- Promise.<void>
(method) apiArrayForce(name, axios, url, options, cache) → {Promise.<void>}
Fetches data from an API and updates an array in the store.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the array in the store. |
axios |
object | The Axios instance used for making API requests. |
url |
string | The URL of the API endpoint. |
options |
object | The options object for the API request. |
cache |
boolean | Indicates whether the response should be cached. |
- Source:
Returns:
- A promise that resolves when the API request is complete.
- Type
- Promise.<void>
(method) apiCache(axios, url, options, cache) → {Promise.<any>}
Makes an API request using Axios.
Parameters:
Name | Type | Description |
---|---|---|
axios |
AxiosInstance | The Axios instance to use for the request. |
url |
string | The URL to make the request to. |
options |
object | The options to pass to the Axios request. |
cache |
boolean | Indicates whether to cache the response. |
- Source:
Returns:
- A promise that resolves to the response data.
- Type
- Promise.<any>
(method) apiDict(name, axios, url, key, value, options, cache) → {Promise.<void>}
Fetches data from an API and stores it in the store if it doesn't already exist.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the store property to store the fetched data. |
axios |
object | The Axios instance used for making API requests. |
url |
string | The URL of the API endpoint. |
key |
string | The key to use for mapping the fetched data to an object. |
value |
string | The value to use for mapping the fetched data to an object. |
options |
object | Additional options for the API request. |
cache |
boolean | Indicates whether to cache the fetched data. |
- Source:
Returns:
- A Promise that resolves when the API request is complete.
- Type
- Promise.<void>
(method) apiDictMulti(names, axios, url, key, value, options, cache) → {Promise.<void>}
Fetches data from an API and populates multiple dictionaries in the store.
Parameters:
Name | Type | Description |
---|---|---|
names |
Array | The names of the dictionaries to populate. |
axios |
Object | The Axios instance for making API requests. |
url |
string | The URL of the API endpoint. |
key |
string | The key to use for mapping objects in the response to the dictionaries. |
value |
string | The value to use for mapping objects in the response to the dictionaries. |
options |
Object | Additional options for the API request. |
cache |
boolean | Indicates whether to cache the API response. |
- Source:
Returns:
- A promise that resolves when the dictionaries are populated.
- Type
- Promise.<void>
(method) apiExec(axios, url, options, cache) → {Promise}
Executes an API request using the provided axios instance.
Parameters:
Name | Type | Description |
---|---|---|
axios |
Object | The axios instance to use for the API request. |
url |
string | The URL of the API endpoint. |
options |
Object | The options for the API request. |
cache |
boolean | Indicates whether to cache the API response. |
- Source:
Returns:
- A promise that resolves to the API response.
- Type
- Promise
(method) apiMultiForce(names, axios, url, options, cache) → {Promise.<void>}
Calls the API using the provided axios instance, URL, options, and cache. Updates the specified store properties with the response data.
Parameters:
Name | Type | Description |
---|---|---|
names |
Array.<string> | The names of the store properties to update. |
axios |
object | The axios instance to use for the API call. |
url |
string | The URL to make the API call to. |
options |
object | The options to pass to the API call. |
cache |
boolean | Indicates whether to cache the API response. |
- Source:
Returns:
- A promise that resolves when the API call is complete.
- Type
- Promise.<void>
(method) apiObject(name, axios, url, options, cache) → {Promise.<void>}
Fetches the API object from the store if it is not already available.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the API object. |
axios |
object | The Axios instance for making HTTP requests. |
url |
string | The URL for fetching the API object. |
options |
object | The options for the API request. |
cache |
boolean | Indicates whether to cache the API response. |
- Source:
Returns:
- A Promise that resolves when the API object is fetched.
- Type
- Promise.<void>
(method) apiObjectForce(name, axios, url, options, cache) → {Promise.<void>}
Updates the specified object in the store with the response from an API call.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the object in the store. |
axios |
object | The axios instance used for the API call. |
url |
string | The URL for the API call. |
options |
object | The options for the API call. |
cache |
boolean | Indicates whether to cache the API response. |
- Source:
Returns:
- A promise that resolves when the API call is complete.
- Type
- Promise.<void>
(method) closePopup()
- Source:
(method) createEmptyRow(columns) → {Object}
Creates an empty row object with default values based on the given columns.
Parameters:
Name | Type | Description |
---|---|---|
columns |
Array | An array of column objects. |
- Source:
Returns:
- An empty row object with default values.
- Type
- Object
(method) delete(url, options) → {Promise}
Sends a DELETE request to the specified URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL to send the request to. |
options |
object | The options for the request. |
- Source:
Returns:
- A promise that resolves with the response data.
- Type
- Promise
(method) findLookupValue(value, tableName)
Finds display value for a lookup value in lookup table
Parameters:
Name | Type | Description |
---|---|---|
value |
* | |
tableName |
* |
- Source:
Returns:
display value for the lookup value in the lookup table
(method) get(url, options, cache) → {Promise}
Makes a GET request to the specified URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL to make the GET request to. |
options |
object | The options to be passed as query parameters. |
cache |
boolean | Indicates whether the response should be cached. |
- Source:
Returns:
- A promise that resolves to the response data.
- Type
- Promise
(method) getIcons() → {Promise.<void>}
Gets icons
- Source:
Returns:
- Type
- Promise.<void>
(method) getImage(url) → {Promise.<(string|null)>}
Retrieves an image from the specified URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL of the image to retrieve. |
- Source:
Returns:
A Promise that resolves to the URL of the retrieved image, or null if the retrieval fails.
- Type
- Promise.<(string|null)>
(method) getProps()
- Source:
(method) getRoutes() → {Promise.<void>}
Gets routes available to the user
- Source:
Returns:
- Type
- Promise.<void>
(method) getValueType(value) → {string}
Returns the type of the given value.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | The value to determine the type of. |
- Source:
Returns:
The type of the value. Possible values are "boolean", "json", or "character varying".
- Type
- string
(method) initPopup(action, rowToPass, rows)
Initializes the properties for custom component in popup.
Parameters:
Name | Type | Description |
---|---|---|
action |
string | The action to be performed. |
rowToPass |
Object | The row object to be passed to the popup. |
rows |
Array | The array of rows in the table. |
- Source:
(method) injectTableAPIProps(tableAPI) → {Promise.<void>}
Injects the properties defined in tableapi_props.
Parameters:
Name | Type | Description |
---|---|---|
tableAPI |
string | The name of the table API. |
- Source:
Returns:
- A promise that resolves when the properties are injected.
- Type
- Promise.<void>
(method) invokeComponent()
- Source:
(method) loadLookup(lookup)
Loads a lookup table from the API or local storage.
Parameters:
Name | Type | Description |
---|---|---|
lookup |
* |
- Source:
(method) loadNews()
- Source:
(method) post(url, options, cache) → {Promise}
Sends a POST request to the specified URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL to send the request to. |
options |
object | The options for the request. |
cache |
boolean | Indicates whether to cache the response. |
- Source:
Returns:
- A promise that resolves with the response data.
- Type
- Promise
(method) prepareRoute(action, row, rows) → {void}
Prepares and activates a route based on the provided action, row, and rows.
Parameters:
Name | Type | Description |
---|---|---|
action |
Object | The action object containing route information. |
row |
Object | The row object. |
rows |
Array | The array of rows. |
- Source:
Returns:
- Type
- void
(method) prepareRow(row, columns)
Prepare row for saving : converts JSON strings to objects, blanks to nulls.
Parameters:
Name | Type | Description |
---|---|---|
row |
Object | The row object. |
columns |
Array.<Object> | The array of column objects. |
- Source:
(method) put(url, options) → {Promise}
Sends a PUT request to the specified URL.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | The URL to send the request to. |
options |
object | The options for the request. |
- Source:
Returns:
- A promise that resolves with the response data.
- Type
- Promise
(method) responseOk(response) → {boolean}
Checks if the response is OK.
Parameters:
Name | Type | Description |
---|---|---|
response |
Object | The response object. |
- Source:
Returns:
- Returns true if the response is OK, otherwise false.
- Type
- boolean
(method) swapIdAndValColumns(columns)
Swaps the id and value columns for lookup fields.
Parameters:
Name | Type | Description |
---|---|---|
columns |
* |
- Source: