Sweep: r.ok-Check bei allen direkten fetch('/api/...')-Aufrufen (SW-503-JSON-Falle)

5 Fundstellen nach dem Marker-Bug-Muster (v1224) gefixt:
- landing-init.js: Stats-Zahlen waeren offline NaN geworden
- social.js: Medien-Upload-Fehler wurde verschluckt (kein ok-Check, kein catch)
- routes.js: Unterwegs-POIs — {detail:...}.filter warf statt sauber []
- map.js: Marker-Melden zeigte Erfolgs-Toast obwohl Request fehlschlug
- settings.js: Update-Check meldete offline faelschlich 'ist aktuell'
Rest geprueft: api.js-Wrapper, wiki/uebungen/trainingsplaene-Helper checken ok,
externe Dienste (Nominatim etc.) laufen nicht ueber den SW-/api/-Zweig.
Bump v1225
This commit is contained in:
rene 2026-06-06 11:42:05 +02:00
parent e6d6a3e697
commit 45534aa8ee
10 changed files with 35 additions and 20 deletions

View file

@ -2762,8 +2762,11 @@ window.Page_routes = (() => {
await Promise.all(NEARBY_TYPES.map(async ({ type, icon, label, svgIcon, color }) => {
try {
const params = new URLSearchParams({ type, fast: 'true', ...bbox });
const pois = await fetch(`/api/osm/pois?${params}`).then(r => r.json());
pois
// r.ok prüfen: SW antwortet offline mit 503+JSON ({detail:…}) → json() wirft nicht
const r = await fetch(`/api/osm/pois?${params}`);
if (!r.ok) throw new Error(`pois ${r.status}`);
const pois = await r.json();
(Array.isArray(pois) ? pois : [])
.filter(p => _isNearTrack(p, track, 100)) // max 100m vom Track-Verlauf
.forEach(p => results.push({ ...p, _icon: icon, _label: label, _svgIcon: svgIcon, _color: color }));
} catch {}