This PR fixes the runtime error that caused Gitea issue #5 to be re-opened. The frontend pages (Library.tsx, BookDetailPage.tsx) were calling API methods that were never added to the booksApi client object.
Changes
frontend/src/api/books.ts — Added 4 missing methods to booksApi:
searchBooks(params) — calls GET /api/books/ with search/filter params
getBook(id) — calls GET /api/books/{id}/ for book detail
getGenres() — calls GET /api/books/genres/ for genre discovery
getAuthors() — calls GET /api/books/authors/ for author discovery
READING_STATUS_OPTIONS constant array for the filter dropdown
docs/backend/search-discovery-spec.md — Updated spec to document the API client methods table
Testing
Frontend compiles without type errors (all imports resolve correctly)
Backend already has the corresponding endpoints (BookViewSet with search, filters, genres/authors actions)
## Fix: Missing book API client methods and types
This PR fixes the runtime error that caused Gitea issue #5 to be re-opened. The frontend pages (Library.tsx, BookDetailPage.tsx) were calling API methods that were never added to the booksApi client object.
### Changes
**frontend/src/api/books.ts** — Added 4 missing methods to `booksApi`:
- `searchBooks(params)` — calls `GET /api/books/` with search/filter params
- `getBook(id)` — calls `GET /api/books/{id}/` for book detail
- `getGenres()` — calls `GET /api/books/genres/` for genre discovery
- `getAuthors()` — calls `GET /api/books/authors/` for author discovery
**frontend/src/types/book.ts** — Added 2 missing exports:
- `BookSearchParams` interface (q, genre, author, reading_status, ordering, page, page_size)
- `READING_STATUS_OPTIONS` constant array for the filter dropdown
**docs/backend/search-discovery-spec.md** — Updated spec to document the API client methods table
### Testing
- Frontend compiles without type errors (all imports resolve correctly)
- Backend already has the corresponding endpoints (BookViewSet with search, filters, genres/authors actions)
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fix: Missing book API client methods and types
This PR fixes the runtime error that caused Gitea issue #5 to be re-opened. The frontend pages (Library.tsx, BookDetailPage.tsx) were calling API methods that were never added to the booksApi client object.
Changes
frontend/src/api/books.ts — Added 4 missing methods to
booksApi:searchBooks(params)— callsGET /api/books/with search/filter paramsgetBook(id)— callsGET /api/books/{id}/for book detailgetGenres()— callsGET /api/books/genres/for genre discoverygetAuthors()— callsGET /api/books/authors/for author discoveryfrontend/src/types/book.ts — Added 2 missing exports:
BookSearchParamsinterface (q, genre, author, reading_status, ordering, page, page_size)READING_STATUS_OPTIONSconstant array for the filter dropdowndocs/backend/search-discovery-spec.md — Updated spec to document the API client methods table
Testing