Исправлена обработка ошибки для пустых дашбордов или полностью свёрнутых изначально
This commit is contained in:
parent
50f7aeaf2f
commit
fd121d5db1
1 changed files with 3 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ export class DashboardsDataService {
|
||||||
const cfg = await this.dashboardsService.load(id);
|
const cfg = await this.dashboardsService.load(id);
|
||||||
const results: WidgetWithData[] = [];
|
const results: WidgetWithData[] = [];
|
||||||
let isSuccess = false;
|
let isSuccess = false;
|
||||||
|
let counter = 0;
|
||||||
if (!cfg?.widgets || cfg?.widgets?.length <= 0) {
|
if (!cfg?.widgets || cfg?.widgets?.length <= 0) {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
@ -35,12 +36,13 @@ export class DashboardsDataService {
|
||||||
cfg,
|
cfg,
|
||||||
);
|
);
|
||||||
if (loadRes.result) {
|
if (loadRes.result) {
|
||||||
|
counter++;
|
||||||
isSuccess = true;
|
isSuccess = true;
|
||||||
loadRes.result.widgetId = widget.id;
|
loadRes.result.widgetId = widget.id;
|
||||||
results.push({ data: loadRes.result, widgetId: widget.id });
|
results.push({ data: loadRes.result, widgetId: widget.id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isSuccess) throw createAppError('CANNOT_LOAD_DATA');
|
if (!isSuccess && counter > 0) throw createAppError('CANNOT_LOAD_DATA');
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue