mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-26 21:15:15 +00:00
Add composable to dynamically use showAlert for individual bots
This commit is contained in:
parent
171c608ea8
commit
3bfdeacb04
|
@ -6,3 +6,11 @@ export function showAlert(message: string, severity: AlertSeverity = 'warning',
|
|||
|
||||
show(message, { title: `${bot ? 'Bot: ' + bot : 'Notification'}`, variant: severity });
|
||||
}
|
||||
|
||||
export function useAlertForBot(botName: string) {
|
||||
return {
|
||||
showAlert: (message: string, severity: AlertSeverity = 'warning') => {
|
||||
showAlert(message, severity, botName);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ import {
|
|||
} from '@/types';
|
||||
import axios, { AxiosResponse } from 'axios';
|
||||
import { defineStore } from 'pinia';
|
||||
import { showAlert } from '../shared/alerts';
|
||||
import { useAlertForBot } from '../shared/alerts';
|
||||
import { useWebSocket } from '@vueuse/core';
|
||||
import { FTWsMessage, FtWsMessageTypes } from '@/types/wsMessageTypes';
|
||||
import { showNotification } from '@/shared/notifications';
|
||||
|
@ -59,6 +59,8 @@ export function createBotSubStore(botId: string, botName: string) {
|
|||
const userService = useUserService(botId);
|
||||
const { api } = useApi(userService, botId);
|
||||
|
||||
const { showAlert } = useAlertForBot(botName);
|
||||
|
||||
const useBotStore = defineStore(botId, {
|
||||
state: () => {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue
Block a user