mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-11 10:43:52 +00:00
22 lines
529 B
TypeScript
22 lines
529 B
TypeScript
import { defineStore } from 'pinia';
|
|
import { AlertType } from '@/types/alertTypes';
|
|
|
|
export const useAlertsStore = defineStore('alerts', {
|
|
state: () => {
|
|
return { activeMessages: [] as AlertType[] };
|
|
},
|
|
actions: {
|
|
addAlert(message: AlertType) {
|
|
this.activeMessages.push(message);
|
|
},
|
|
removeAlert() {
|
|
this.activeMessages.shift();
|
|
},
|
|
},
|
|
});
|
|
|
|
export function showAlert(message: string, severity = '') {
|
|
const alertsStore = useAlertsStore();
|
|
alertsStore.addAlert({ message, severity });
|
|
}
|