Convert ftbot getters to enum

This commit is contained in:
Matthias 2020-08-23 20:35:37 +02:00
parent dd6a03db66
commit df54a797f5
2 changed files with 9 additions and 5 deletions

View File

@ -62,8 +62,6 @@ export default class TradeList extends Vue {
@ftbot.State detailTradeId?: string; @ftbot.State detailTradeId?: string;
@ftbot.Getter openTradeDetail?: Trade;
@ftbot.Mutation setDetailTrade; @ftbot.Mutation setDetailTrade;
@ftbot.Action forcesell!: (tradeid: string) => Promise<string>; @ftbot.Action forcesell!: (tradeid: string) => Promise<string>;

View File

@ -1,6 +1,12 @@
import { api } from '@/shared/apiService'; import { api } from '@/shared/apiService';
import { BotState, BlacklistPayload, ForcebuyPayload, Logs, DailyPayload } from '@/store/types'; import { BotState, BlacklistPayload, ForcebuyPayload, Logs, DailyPayload } from '@/store/types';
export enum UserStoreGetters {
openTrades = 'openTrades',
openTradeDetail = 'openTradeDetail',
closedTrades = 'closedTrades',
}
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
@ -20,14 +26,14 @@ export default {
detailTradeId: null, detailTradeId: null,
}, },
getters: { getters: {
openTrades(state) { [UserStoreGetters.openTrades](state) {
return state.openTrades; return state.openTrades;
}, },
openTradeDetail(state) { [UserStoreGetters.openTradeDetail](state) {
const [dTrade] = state.openTrades.filter((item) => item.trade_id === state.detailTradeId); const [dTrade] = state.openTrades.filter((item) => item.trade_id === state.detailTradeId);
return dTrade; return dTrade;
}, },
closedTrades(state) { [UserStoreGetters.closedTrades](state) {
return state.trades.filter((item) => !item.is_open); return state.trades.filter((item) => !item.is_open);
}, },
}, },