Stores Overview
PIP AI uses Pinia for global state management. Stores are defined in app/stores/ and auto-imported by Nuxt.
Available Stores
| Store | File | Purpose |
|---|---|---|
useAppStore | app/stores/app.ts | Global UI state, theme management |
useProjectsStore | app/stores/projects.ts | Project list, current project |
usePipItemsStore | app/stores/pipItems.ts | PIP items for active project |
Pinia Conventions
- Stores use the Setup Store syntax (Composition API style)
- Store IDs match the file name (e.g.,
app,projects,pipItems) - Stores are auto-imported — use
useAppStore()directly in components - Stores are reactive — use
storeToRefs()for template bindings
Usage Example
typescript
// In a component
const appStore = useAppStore()
const { currentTheme, sidebarOpen } = storeToRefs(appStore)
// Actions
appStore.setTheme('dark')
appStore.toggleSidebar()