A global mixin object containing common API calls
- Source:
Methods
(method) activateRoute(route)
Activates a route by adding it to the Vue Router if it doesn't exist, and then navigates to the activated route.
Parameters:
Name | Type | Description |
---|---|---|
route |
Object | The route object containing information about the route. |
- Source:
(function) importedComponent()
- Source:
(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()
- Source:
(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) 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) 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()
- Source:
(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) getRoutes()
- 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) 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