-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the book fetching logic to include the isFavorited status directly from the server. This eliminates the need for a separate request to fetch user favorites.
- Loading branch information
Showing
8 changed files
with
29 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 3 additions & 9 deletions
12
src/components/LibraryPage/components/Books/components/BooksView/BooksView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,9 @@ | ||
import { BookCard, Message } from "../"; | ||
import { Book } from "../../../../../../data/books"; | ||
import { Book } from "@/data/books"; | ||
|
||
interface BookWithFavoriteStatus extends Book { | ||
isFavorited: boolean; | ||
} | ||
|
||
export const BooksView = ({ books }: { books: BookWithFavoriteStatus[] }) => | ||
export const BooksView = ({ books }: { books: Book[] }) => | ||
books.length > 0 ? ( | ||
books.map((book: BookWithFavoriteStatus) => ( | ||
<BookCard key={book.id} book={book} isFavorited={book.isFavorited} /> | ||
)) | ||
books.map((book: Book) => <BookCard key={book.id} book={book} />) | ||
) : ( | ||
<Message text="No books available" /> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters