Fix commentary JSON parse error for chapters without coverage

This commit is contained in:
nmemmert
2026-06-11 14:45:47 -04:00
parent bb92095ba4
commit 603c3bcbf2
+2 -1
View File
@@ -931,7 +931,8 @@ const App = () => {
const cacheKey = `${commentaryId}/${bookAbbrev}/${chapterNumber}`;
if (_commentaryCacheRef.current[cacheKey]) return _commentaryCacheRef.current[cacheKey];
const res = await fetch(`https://bible.helloao.org/api/c/${commentaryId}/${bookAbbrev}/${chapterNumber}.json`);
if (!res.ok) throw new Error(`No ${commentaryId} commentary for this chapter.`);
const contentType = res.headers.get('content-type') || '';
if (!res.ok || !contentType.includes('json')) throw new Error(`No ${commentaryId} commentary for this chapter.`);
const data = await res.json();
_commentaryCacheRef.current[cacheKey] = data;
return data;