mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-27 05:25:17 +00:00
Convert ftbot getters to enum
This commit is contained in:
parent
dd6a03db66
commit
df54a797f5
|
@ -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>;
|
||||||
|
|
|
@ -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);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user