Some checks failed
Rebuild Issue Index / build-index (push) Has been cancelled
- Create MusicDetails component with artist info, albums, stats, request button - Create BookDetails component with cover, overview, request button - Create music/[artistId] and book/[bookId] pages - Update Search component with tabbed interface (Movies & TV, Music, Books) - Music/Book search results with card grid and cover art - Link to detail pages from search results
34 lines
827 B
TypeScript
34 lines
827 B
TypeScript
import BookDetails from '@app/components/BookDetails';
|
|
import axios from 'axios';
|
|
import type { GetServerSideProps, NextPage } from 'next';
|
|
|
|
interface BookPageProps {
|
|
book?: any;
|
|
}
|
|
|
|
const BookPage: NextPage<BookPageProps> = ({ book }) => {
|
|
return <BookDetails book={book} />;
|
|
};
|
|
|
|
export const getServerSideProps: GetServerSideProps<BookPageProps> = async (
|
|
ctx
|
|
) => {
|
|
try {
|
|
const response = await axios.get(
|
|
`http://${process.env.HOST || 'localhost'}:${
|
|
process.env.PORT || 5055
|
|
}/api/v1/book/search?query=${ctx.query.bookId}`,
|
|
{
|
|
headers: ctx.req?.headers?.cookie
|
|
? { cookie: ctx.req.headers.cookie }
|
|
: undefined,
|
|
}
|
|
);
|
|
return { props: { book: response.data?.results?.[0] } };
|
|
} catch {
|
|
return { props: {} };
|
|
}
|
|
};
|
|
|
|
export default BookPage;
|