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