Properly handle dashboard startup

This commit is contained in:
Matthias 2022-05-12 19:25:01 +02:00
parent 3bf4eb94c6
commit ccfa81b051
2 changed files with 17 additions and 14 deletions

View File

@ -205,19 +205,22 @@ export function createBotSubStore(botId: string, botName: string) {
}
// Refresh data only when needed
if (forceUpdate || this.refreshRequired) {
this.refreshing = true;
// TODO: Should be AxiosInstance
const updates: Promise<any>[] = [];
updates.push(this.getPerformance());
updates.push(this.getProfit());
updates.push(this.getTrades());
updates.push(this.getBalance());
// /* white/blacklist might be refreshed more often as they are not expensive on the backend */
updates.push(this.getWhitelist());
updates.push(this.getBlacklist());
await Promise.all(updates);
this.refreshRequired = false;
this.refreshing = false;
try {
this.refreshing = true;
// TODO: Should be AxiosInstance
const updates: Promise<any>[] = [];
updates.push(this.getPerformance());
updates.push(this.getProfit());
updates.push(this.getTrades());
updates.push(this.getBalance());
// /* white/blacklist might be refreshed more often as they are not expensive on the backend */
updates.push(this.getWhitelist());
updates.push(this.getBlacklist());
await Promise.all(updates);
this.refreshRequired = false;
} finally {
this.refreshing = false;
}
}
return Promise.resolve();
},

View File

@ -183,7 +183,7 @@ export default defineComponent({
onMounted(async () => {
await botStore.allGetDaily({ timescale: 30 });
botStore.activeBot.getTrades();
// botStore.activeBot.getTrades();
botStore.activeBot.getOpenTrades();
botStore.activeBot.getProfit();
});