Add type for whitelist resonse

This commit is contained in:
Matthias 2020-09-12 09:07:20 +02:00
parent fa8b43fdf1
commit 2b8c89eba4
3 changed files with 11 additions and 3 deletions

View File

@ -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;
},

View File

@ -8,3 +8,9 @@ export interface BlacklistResponse {
blacklist: Array<string>;
errors: Record<string, string>;
}
export interface WhitelistResponse {
method: Array<string>;
length: number;
whitelist: Array<string>;
}

View File

@ -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<any>;
@ftbot.Action public getWhitelist!: () => Promise<WhitelistResponse>;
@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();