Show the server's error message when the library fails to load
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c699aca5b0
commit
6f7cddd1e5
1 file changed
+1
-1
+1
-1
@@ -169,7 +169,7 @@ const series = b => pick(b, 'series_name', 'series') || '';
|
||||
const cover = b => `/api/books/${encodeURIComponent(bookId(b))}/cover`;
|
||||
const fmt = s => { s = Math.max(0, Math.floor(s || 0)); const h = Math.floor(s/3600), m = Math.floor(s%3600/60), x = s%60;
|
||||
return (h ? h + ':' + String(m).padStart(2, '0') : m) + ':' + String(x).padStart(2, '0'); };
|
||||
const get = async p => { const r = await fetch(p); if (r.status === 401) { location.href = '/login'; throw new Error('Signing in…'); } if (!r.ok) throw new Error(r.status === 401 ? 'Not signed in (401)' : p + ' → ' + r.status); return r.json(); };
|
||||
const get = async p => { const r = await fetch(p); if (r.status === 401) { location.href = '/login'; throw new Error('Signing in…'); } if (!r.ok) { let m = ''; try { m = (await r.json()).error || ''; } catch {} throw new Error(m || p + ' → ' + r.status); } return r.json(); };
|
||||
const store = {
|
||||
get: k => { try { return JSON.parse(localStorage.getItem(k)); } catch { return null; } },
|
||||
set: (k, v) => { try { localStorage.setItem(k, JSON.stringify(v)); } catch {} }
|
||||
|
||||
Reference in new issue
Block a user