fix: dual id/name matching for installed + console.error on all catches
This commit is contained in:
@@ -35,17 +35,17 @@ const PageMarket = {
|
||||
const data = await res.json();
|
||||
const items = data.items || [];
|
||||
|
||||
let localIds = [];
|
||||
let localIds = [], localNames = [];
|
||||
try {
|
||||
const lr = await fetch('/api/dashboards?category=all');
|
||||
const ld = await lr.json();
|
||||
if (Array.isArray(ld)) localIds = ld.map(d => d.id);
|
||||
if (Array.isArray(ld)) { localIds = ld.map(d => d.id); localNames = ld.map(d => d.name); }
|
||||
if (isScene) {
|
||||
const sr = await fetch('/api/scenes');
|
||||
const sl = await sr.json();
|
||||
if (Array.isArray(sl)) localIds = localIds.concat(sl.map(s => s.id));
|
||||
if (Array.isArray(sl)) { localIds = localIds.concat(sl.map(s => s.id)); localNames = localNames.concat(sl.map(s => s.name)); }
|
||||
}
|
||||
} catch(e) {}
|
||||
} catch(e) { console.error('load local:', e); }
|
||||
|
||||
if (!items.length) { grid.innerHTML = this._emptyHtml(isScene ? '暂无场景' : '暂无仪表盘'); return; }
|
||||
grid.innerHTML = items.map(d => {
|
||||
|
||||
Reference in New Issue
Block a user