From 2b8c89eba47aab6c837234f4152b99baa8445d7a Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 12 Sep 2020 09:07:20 +0200 Subject: [PATCH] Add type for whitelist resonse --- src/store/modules/ftbot.ts | 3 ++- src/types/blacklist.ts | 6 ++++++ src/views/Graphs.vue | 5 +++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/store/modules/ftbot.ts b/src/store/modules/ftbot.ts index 7c8a52cb..22dfb36d 100644 --- a/src/store/modules/ftbot.ts +++ b/src/store/modules/ftbot.ts @@ -13,6 +13,7 @@ import { EMPTY_PLOTCONFIG, AvailablePairPayload, PlotConfigStorage, + WhitelistResponse, } from '@/types'; import { @@ -89,7 +90,7 @@ export default { updatePerformance(state, performance) { state.performanceStats = performance; }, - updateWhitelist(state, whitelist) { + updateWhitelist(state, whitelist: WhitelistResponse) { state.whitelist = whitelist.whitelist; state.pairlistMethods = whitelist.method; }, diff --git a/src/types/blacklist.ts b/src/types/blacklist.ts index e21e9bf6..fbe00a41 100644 --- a/src/types/blacklist.ts +++ b/src/types/blacklist.ts @@ -8,3 +8,9 @@ export interface BlacklistResponse { blacklist: Array; errors: Record; } + +export interface WhitelistResponse { + method: Array; + length: number; + whitelist: Array; +} diff --git a/src/views/Graphs.vue b/src/views/Graphs.vue index 047387e1..af120103 100644 --- a/src/views/Graphs.vue +++ b/src/views/Graphs.vue @@ -41,6 +41,7 @@ import { AvailablePairResult, PairCandlePayload, PairHistoryPayload, + WhitelistResponse, } from '@/types'; const ftbot = namespace('ftbot'); @@ -77,7 +78,7 @@ export default class Graphs extends Vue { // eslint-disable-next-line @typescript-eslint/no-unused-vars @ftbot.Action public getPairHistory!: (payload: PairHistoryPayload) => void; - @ftbot.Action public getWhitelist!: () => Promise; + @ftbot.Action public getWhitelist!: () => Promise; @ftbot.Action public getAvailablePairs!: ( // eslint-disable-next-line @typescript-eslint/no-unused-vars @@ -86,7 +87,7 @@ export default class Graphs extends Vue { mounted() { this.getWhitelist().then((whitelist) => { - console.log(whitelist?.whitelist?.length > 0); + // Autoselect first pair in whitelist if (whitelist?.whitelist?.length > 0) { [this.pair] = whitelist.whitelist; this.refresh();