From df54a797f57e99567762ae791be4bd0ec029f438 Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 23 Aug 2020 20:35:37 +0200 Subject: [PATCH] Convert ftbot getters to enum --- src/components/ftbot/TradeList.vue | 2 -- src/store/modules/ftbot.ts | 12 +++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/ftbot/TradeList.vue b/src/components/ftbot/TradeList.vue index 2ec76808..079a11d1 100644 --- a/src/components/ftbot/TradeList.vue +++ b/src/components/ftbot/TradeList.vue @@ -62,8 +62,6 @@ export default class TradeList extends Vue { @ftbot.State detailTradeId?: string; - @ftbot.Getter openTradeDetail?: Trade; - @ftbot.Mutation setDetailTrade; @ftbot.Action forcesell!: (tradeid: string) => Promise; diff --git a/src/store/modules/ftbot.ts b/src/store/modules/ftbot.ts index 02e63924..31b6c6cd 100644 --- a/src/store/modules/ftbot.ts +++ b/src/store/modules/ftbot.ts @@ -1,6 +1,12 @@ import { api } from '@/shared/apiService'; import { BotState, BlacklistPayload, ForcebuyPayload, Logs, DailyPayload } from '@/store/types'; +export enum UserStoreGetters { + openTrades = 'openTrades', + openTradeDetail = 'openTradeDetail', + closedTrades = 'closedTrades', +} + export default { namespaced: true, state: { @@ -20,14 +26,14 @@ export default { detailTradeId: null, }, getters: { - openTrades(state) { + [UserStoreGetters.openTrades](state) { return state.openTrades; }, - openTradeDetail(state) { + [UserStoreGetters.openTradeDetail](state) { const [dTrade] = state.openTrades.filter((item) => item.trade_id === state.detailTradeId); return dTrade; }, - closedTrades(state) { + [UserStoreGetters.closedTrades](state) { return state.trades.filter((item) => !item.is_open); }, },