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 strategyName = computed(() => props.strategy || dataset.value?.strategy || '');
const datasetColumns = computed(() => (dataset.value ? dataset.value.columns : [])); 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 => { const isLoadingDataset = computed((): boolean => {
if (props.historicView) { if (props.historicView) {
return botStore.activeBot.historyStatus === LoadingStatus.loading; return botStore.activeBot.historyStatus === LoadingStatus.loading;

View File

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