Fix TypeScript compilation errors in BookSelector and ChapterSelector by explicitly typing Set<string>
This commit is contained in:
@@ -30,11 +30,11 @@ const BookSelector: React.FC<BookSelectorProps> = ({ books, onBookSelect, format
|
|||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const bookFavorites = new Set(
|
const favoriteBooks: string[] = data.favorites
|
||||||
data.favorites
|
.filter((fav: any) => !fav.chapter) // Only book-level favorites
|
||||||
.filter((fav: any) => !fav.chapter) // Only book-level favorites
|
.map((fav: any) => fav.book);
|
||||||
.map((fav: any) => fav.book)
|
|
||||||
);
|
const bookFavorites = new Set<string>(favoriteBooks);
|
||||||
setFavorites(bookFavorites);
|
setFavorites(bookFavorites);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ const ChapterSelector: React.FC<ChapterSelectorProps> = ({ book, onChapterSelect
|
|||||||
|
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const chapterFavorites = new Set(
|
const favoriteChapters: string[] = data.favorites
|
||||||
data.favorites
|
.filter((fav: any) => fav.book === book && fav.chapter && !fav.verse_start) // Only chapter-level favorites for this book
|
||||||
.filter((fav: any) => fav.book === book && fav.chapter && !fav.verse_start) // Only chapter-level favorites for this book
|
.map((fav: any) => fav.chapter);
|
||||||
.map((fav: any) => fav.chapter)
|
|
||||||
);
|
const chapterFavorites = new Set<string>(favoriteChapters);
|
||||||
setFavorites(chapterFavorites);
|
setFavorites(chapterFavorites);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user