Methods
# static useGet(url, defaultValueopt, optionsopt) → {Array.<(object|boolean|function())>}
Hook to use Axios get request without caching
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string
|
url to fetch | |
defaultValue |
object
|
<optional> |
default value of the data state |
options |
object
|
<optional> |
options for various things |
resultMapper |
function
|
<optional> |
function to map the results |
data, isLoading, setData
Array.<(object|boolean|function())>
# static useLayout(type, key, url, existingLayout)
Layout fetching hook that assumes the default layout endpoint
Parameters:
Name | Type | Description |
---|---|---|
type |
string
|
object type for standard get layout endpoint |
key |
string
|
layout key for standard get layout endpoint |
url |
string
|
optional if you are not using the standard endpoint |
existingLayout |
object
|
optional if you already have the layout and do not want to fetch it |
[object, boolean] - layout, loading
# static useMapConfig() → {Array.<(object|boolean)>}
Hook to fetch map config by key or cache
mapConfig, mapConfigLoading
Array.<(object|boolean)>
# static useStaleData(url, defaultValue, useDefault, clearCache, forceError) → {Array.<(object|boolean)>}
Hook that will fetch data from a url and cache it
If the isDev flag is set to true, the first fetch will be faked and defaultValue will be returned and set in cache
Parameters:
Name | Type | Description |
---|---|---|
url |
string
|
url to fetch data from |
defaultValue |
any
|
default value to use if the cache is empty |
useDefault |
boolean
|
flag to use the default value |
clearCache |
boolean
|
flag to clear the cache |
forceError |
boolean
|
flag to force an error |
data, loading
Array.<(object|boolean)>
# inner useConfig(config_key) → {Array.<(object|boolean)>}
Hook to fetch config by key or cache
Parameters:
Name | Type | Description |
---|---|---|
config_key |
string
|
config, loading
Array.<(object|boolean)>