mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 11:35:14 +00:00
Remove alert store logic
This commit is contained in:
parent
9682d76c11
commit
491b6d19bb
|
@ -1,22 +1,8 @@
|
||||||
import { defineStore } from 'pinia';
|
import { AlertSeverity } from '@/types/alertTypes';
|
||||||
import { AlertSeverity, AlertType } from '@/types/alertTypes';
|
import { useToast } from 'bootstrap-vue-next';
|
||||||
|
|
||||||
export const useAlertsStore = defineStore('alerts', {
|
|
||||||
state: () => {
|
|
||||||
return { activeMessages: [] as AlertType[] };
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
addAlert(message: AlertType) {
|
|
||||||
this.activeMessages.push(message);
|
|
||||||
},
|
|
||||||
removeAlert(alert: AlertType) {
|
|
||||||
console.log('dismissed', alert);
|
|
||||||
this.activeMessages = this.activeMessages.filter((v) => v !== alert);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export function showAlert(message: string, severity: AlertSeverity = 'warning') {
|
export function showAlert(message: string, severity: AlertSeverity = 'warning') {
|
||||||
const alertsStore = useAlertsStore();
|
const { show } = useToast();
|
||||||
alertsStore.addAlert({ message, severity, timeout: 5000 });
|
|
||||||
|
show(message, { title: 'Msg', variant: severity, animation: true, value: true });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user