mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-22 11:05:17 +00:00
chore: Properly type alerts
This commit is contained in:
parent
7350b5109a
commit
e0a47f49f1
|
@ -19,12 +19,13 @@ import { Component, Vue } from 'vue-property-decorator';
|
||||||
import { namespace } from 'vuex-class';
|
import { namespace } from 'vuex-class';
|
||||||
import { AlertActions } from '@/store/modules/alerts';
|
import { AlertActions } from '@/store/modules/alerts';
|
||||||
import StoreModules from '@/store/storeSubModules';
|
import StoreModules from '@/store/storeSubModules';
|
||||||
|
import { AlertType } from '@/types/alertTypes';
|
||||||
|
|
||||||
const alerts = namespace(StoreModules.alerts);
|
const alerts = namespace(StoreModules.alerts);
|
||||||
|
|
||||||
@Component({})
|
@Component({})
|
||||||
export default class BotAlerts extends Vue {
|
export default class BotAlerts extends Vue {
|
||||||
@alerts.State activeMessages;
|
@alerts.State activeMessages!: AlertType[];
|
||||||
|
|
||||||
@alerts.Action [AlertActions.removeAlert];
|
@alerts.Action [AlertActions.removeAlert];
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { AlertType } from '@/types/alertTypes';
|
||||||
|
|
||||||
export enum AlertActions {
|
export enum AlertActions {
|
||||||
addAlert = 'addAlert',
|
addAlert = 'addAlert',
|
||||||
removeAlert = 'removeAlert',
|
removeAlert = 'removeAlert',
|
||||||
|
@ -14,7 +16,7 @@ export default {
|
||||||
activeMessages: [],
|
activeMessages: [],
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
[AlertMutations.addAlert](state, message) {
|
[AlertMutations.addAlert](state, message: AlertType) {
|
||||||
console.log(`adding message '${message.message}' to message queue`);
|
console.log(`adding message '${message.message}' to message queue`);
|
||||||
state.activeMessages.push(message);
|
state.activeMessages.push(message);
|
||||||
},
|
},
|
||||||
|
@ -23,7 +25,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
[AlertActions.addAlert]({ commit }, message) {
|
[AlertActions.addAlert]({ commit }, message: AlertType) {
|
||||||
commit(AlertMutations.addAlert, message);
|
commit(AlertMutations.addAlert, message);
|
||||||
},
|
},
|
||||||
[AlertActions.removeAlert]({ commit }) {
|
[AlertActions.removeAlert]({ commit }) {
|
||||||
|
|
4
src/types/alertTypes.ts
Normal file
4
src/types/alertTypes.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export interface AlertType {
|
||||||
|
message: string;
|
||||||
|
severity: string;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user