Appearance
Store Documentation ​
Overview ​
The Vuex store manages application-wide state. The Admin Frontend uses a modular store structure with separate modules for different features.
Store Structure ​
store/
├── index.js # Root store configuration
├── dam.js # DAM module state
├── loading.js # Global loading overlay state
└── analytics/ # Analytics state
└── index.jsStore Modules ​
DAM Store ​
- File:
store/dam.js - Purpose: Digital Asset Management state
State:
- Folder list
- Asset list
- DAM instance
- Storage information
- Download indicators
- Upload queue
- Notifications
Loading Store ​
- File:
store/loading.js - Purpose: Global loading overlay state used by
startOverlay/stopOverlayroot actions
State:
isLoading— global loading flagloadingText— overlay message textapiLongRunningCount— count of in-flight long-running API requests
Mutations: mutateLoading, mutateLoadingText, INCREMENT_API_LONG_RUNNING, DECREMENT_API_LONG_RUNNING
Getter: showApiLongRunningOverlay — true when apiLongRunningCount > 0
Analytics Store ​
- File:
store/analytics/index.js - Purpose: Analytics tracking state
State:
- User agent and location
- Email tracking
- Event queue
Root Store ​
Actions ​
nuxtClientInit({ commit }, context) ​
Initializes client-side store:
- Sets up authentication watchers
- Handles storage synchronization
- Manages cross-tab authentication
startOverlay(context, [isLoading, loadingText]) ​
Shows loading overlay.
Parameters:
isLoading(Boolean) - Show/hide overlayloadingText(String) - Loading message
stopOverlay(context) ​
Hides loading overlay.
Accessing Store ​
In Components ​
javascript
// Getter
this.$store.getters['dam/folderList']
// Action
this.$store.dispatch('dam/fetchFolders', workspaceId)
// Mutation (avoid direct mutation)
this.$store.commit('dam/SET_FOLDER_LIST', folders)In Middleware ​
javascript
export default function ({ store }) {
const folders = store.getters['dam/folderList']
await store.dispatch('dam/fetchFolders', workspaceId)
}Store Best Practices ​
- Use Actions for Async: All async operations should use actions
- Mutations are Synchronous: Only mutations modify state
- Getters for Computed State: Use getters for derived state
- Module Namespacing: All modules are namespaced
- State Initialization: Initialize state with default values