Fix route ordering: /search before /{asset_id}

- /api/assets/search must be registered before /api/assets/{asset_id}
  to prevent FastAPI path param from catching 'search' as an asset_id.
  Returning a 422 with array detail caused frontend to show [object Object].
- Improve error message extraction in clearAssetGps catch block.
This commit is contained in:
Leo
2026-05-22 23:45:26 -04:00
parent 9794d8076c
commit 8d5deb735b
2 changed files with 15 additions and 12 deletions
+5 -1
View File
@@ -2169,7 +2169,11 @@ async function clearAssetGps() {
showToast('GPS data cleared');
} catch (e) {
resultEl.style.display = '';
resultEl.innerHTML = '<span style="color:var(--red);">' + esc(e.message) + '</span>';
const errMsg = (e && typeof e.message === 'string') ? e.message
: (typeof e === 'string') ? e
: (e && e.detail && typeof e.detail === 'string') ? e.detail
: 'Unknown error';
resultEl.innerHTML = '<span style="color:var(--red);">' + esc(errMsg) + '</span>';
}
}