Module

useData

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

View Source hooks/useData.js, line 179

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

View Source hooks/useData.js, line 19

[object, boolean] - layout, loading

# static useMapConfig() → {Array.<(object|boolean)>}

Hook to fetch map config by key or cache

View Source hooks/useData.js, line 32

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

View Source hooks/useData.js, line 92

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

View Source hooks/useData.js, line 54

config, loading
Array.<(object|boolean)>