Stores — state management and API wrappers¶
This document describes the stores under app/frontend/src/stores. The project uses zustand for client state with both simple UI stores and domain stores that wrap API calls.
Store pattern summary¶
- Implementation: each store uses
createfromzustand. Many domain stores follow a pattern ofitems,loading,error, and action methods (fetchAll,create,update,remove). - API interaction: stores call
fetchApifromhelpers/ApiHelper. - UI stores: small stores like
useDialogStoremanage transient UI state (open dialogs, modals).useAuthStoreusespersistmiddleware to save auth state.
Key stores¶
useAuthStore.tsx— persisted auth state:user,access_token,access_token_expires, pluslogin/logout.useDialogStore.ts— small UI store for global dialog management (open/close, payload).UsersStore.tsx— manages users list, currentme, and user CRUD operations.RoomsStore.tsx— room list and room-specific actions.RolesStore.tsx,PermissionsStore.tsx— role/permission lists and role/permission-specific actions.EventsStore.tsx,EventTypesStore.tsx— event/event-type list and event/type-specific actions.TasksStore.tsx,TaskTypesStore.tsx— task/task-type list and task/type-specific actions.DisplaysStore.tsx— display lists and display-specific actions.