useNavigationStore
This store loads the navigation data from the API and provides it to the website
Used by
State
| Name | Type | Description |
|---|---|---|
loading | ref | Loading state of data |
rawNavItems | ref | Raw data from the Navigation API |
Actions
fetchNavigation
Fetches the navigation data from the navigation API endpoint, populates the subitems recursively and assigns the result to the rawNavItems state. It sets the loading state to true before the call and to false after the call, regardless of the result (success or error). If the API call fails or the response does not contain the expected data, it logs an error to the console.
_fetchSubitems
Fetches and returns subitems for a given navigation item reference. This function makes an API call to retrieve content associated with the provided reference, and formats the content into an array of subitems. Each subitem includes a label, an icon, and a link with a path and query parameters. If an error occurs during the API call, it logs the error and returns an empty array.
Getters/Setters
navItems (computed)
Convert the loaded, raw data to the format we need to work with it in the frontend
