useAlert ​
Triggers a global alert notification by committing to the Vuex alert store module.
File: vue/src/js/hooks/useAlert.js
Usage ​
js
import { useAlert } from '@/hooks'
const { openAlert } = useAlert()
openAlert({ message: 'Saved successfully', variant: 'success' })
openAlert({ message: 'Something went wrong', variant: 'error' })Returns ​
| Name | Type | Description |
|---|---|---|
openAlert | (payload) => void | Commit an alert to the store |
Payload ​
| Key | Type | Description |
|---|---|---|
message | String | Alert message text |
variant | String | 'success' | 'error' | 'warning' | 'info' |
location | String | Optional. Vuetify snackbar location, e.g. 'top' |
Notes ​
- The alert is rendered by the global snackbar component that reads from
store.state.alert. useItemActionsand table hooks callopenAlertinternally after server actions complete.
See Also ​
- useItemActions — calls
openAlerton action success/error