mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-25 12:35:15 +00:00
Fix small bug in handling invalid responses
This commit is contained in:
parent
3ab4aed5f4
commit
4de3a96fae
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -3,6 +3,8 @@ node_modules
|
||||||
package-lock.json
|
package-lock.json
|
||||||
/dist
|
/dist
|
||||||
|
|
||||||
|
cypress/screenshots/*
|
||||||
|
|
||||||
# local env files
|
# local env files
|
||||||
.env.local
|
.env.local
|
||||||
.env.*.local
|
.env.*.local
|
||||||
|
|
|
@ -216,8 +216,11 @@ export default defineComponent({
|
||||||
() => botStore.activeBotorUndefined?.openTradeCount,
|
() => botStore.activeBotorUndefined?.openTradeCount,
|
||||||
() => {
|
() => {
|
||||||
console.log('openTradeCount changed');
|
console.log('openTradeCount changed');
|
||||||
if (settingsStore.openTradesInTitle === OpenTradeVizOptions.showPill) {
|
if (
|
||||||
setOpenTradesAsPill(botStore.activeBot.openTradeCount);
|
settingsStore.openTradesInTitle === OpenTradeVizOptions.showPill &&
|
||||||
|
botStore.activeBotorUndefined?.openTradeCount
|
||||||
|
) {
|
||||||
|
setOpenTradesAsPill(botStore.activeBotorUndefined.openTradeCount);
|
||||||
} else if (settingsStore.openTradesInTitle === OpenTradeVizOptions.asTitle) {
|
} else if (settingsStore.openTradesInTitle === OpenTradeVizOptions.asTitle) {
|
||||||
setTitle();
|
setTitle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
const res = await fetchTrades(pageLength, 0);
|
const res = await fetchTrades(pageLength, 0);
|
||||||
const result: TradeResponse = res.data;
|
const result: TradeResponse = res.data;
|
||||||
let { trades } = result;
|
let { trades } = result;
|
||||||
if (trades.length !== result.total_trades) {
|
if (Array.isArray(trades) && trades.length !== result.total_trades) {
|
||||||
// Pagination necessary
|
// Pagination necessary
|
||||||
// Don't use Promise.all - this would fire all requests at once, which can
|
// Don't use Promise.all - this would fire all requests at once, which can
|
||||||
// cause problems for big sqlite databases
|
// cause problems for big sqlite databases
|
||||||
|
@ -274,7 +274,6 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
trades = trades.concat(result.trades);
|
trades = trades.concat(result.trades);
|
||||||
totalTrades = res.data.total_trades;
|
totalTrades = res.data.total_trades;
|
||||||
} while (trades.length !== totalTrades);
|
} while (trades.length !== totalTrades);
|
||||||
}
|
|
||||||
const tradesCount = trades.length;
|
const tradesCount = trades.length;
|
||||||
// Add botId to all trades
|
// Add botId to all trades
|
||||||
trades = trades.map((t) => ({
|
trades = trades.map((t) => ({
|
||||||
|
@ -285,6 +284,8 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
}));
|
}));
|
||||||
this.trades = trades;
|
this.trades = trades;
|
||||||
this.tradeCount = tradesCount;
|
this.tradeCount = tradesCount;
|
||||||
|
}
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (axios.isAxiosError(error)) {
|
if (axios.isAxiosError(error)) {
|
||||||
|
@ -309,7 +310,6 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
// Open trades changed, so we should refresh now.
|
// Open trades changed, so we should refresh now.
|
||||||
this.refreshRequired = true;
|
this.refreshRequired = true;
|
||||||
// dispatch('refreshSlow', null, { root: true });
|
// dispatch('refreshSlow', null, { root: true });
|
||||||
}
|
|
||||||
|
|
||||||
const openTrades = result.data.map((t) => ({
|
const openTrades = result.data.map((t) => ({
|
||||||
...t,
|
...t,
|
||||||
|
@ -318,6 +318,9 @@ export function createBotSubStore(botId: string, botName: string) {
|
||||||
botTradeId: `${botId}__${t.trade_id}`,
|
botTradeId: `${botId}__${t.trade_id}`,
|
||||||
}));
|
}));
|
||||||
this.openTrades = openTrades;
|
this.openTrades = openTrades;
|
||||||
|
} else {
|
||||||
|
this.openTrades = [];
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user