Improve handling of empty pair-data responses

This commit is contained in:
Matthias 2023-03-07 18:19:44 +01:00
parent c3c21f5a36
commit a03f1bb917
2 changed files with 4 additions and 4 deletions

View File

@ -132,7 +132,7 @@ const dataset = computed((): PairHistory => {
});
const strategyName = computed(() => props.strategy || dataset.value?.strategy || '');
const datasetColumns = computed(() => (dataset.value ? dataset.value.columns : []));
const hasDataset = computed(() => !!dataset.value);
const hasDataset = computed(() => dataset.value && dataset.value.data.length > 0);
const isLoadingDataset = computed((): boolean => {
if (props.historicView) {
return botStore.activeBot.historyStatus === LoadingStatus.loading;

View File

@ -340,7 +340,7 @@ export function createBotSubStore(botId: string, botName: string) {
},
getPairCandles(payload: PairCandlePayload) {
if (payload.pair && payload.timeframe) {
this.historyStatus = LoadingStatus.loading;
this.candleDataStatus = LoadingStatus.loading;
return api
.get('/pair_candles', {
params: { ...payload },
@ -354,11 +354,11 @@ export function createBotSubStore(botId: string, botName: string) {
data: result.data,
},
};
this.historyStatus = LoadingStatus.success;
this.candleDataStatus = LoadingStatus.success;
})
.catch((err) => {
console.error(err);
this.historyStatus = LoadingStatus.error;
this.candleDataStatus = LoadingStatus.error;
});
}
// Error branchs