You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
799 B
34 lines
799 B
import TvDetails from '@app/components/TvDetails';
|
|
import type { TvDetails as TvDetailsType } from '@server/models/Tv';
|
|
import axios from 'axios';
|
|
import type { GetServerSideProps, NextPage } from 'next';
|
|
|
|
interface TvPageProps {
|
|
tv?: TvDetailsType;
|
|
}
|
|
|
|
const TvPage: NextPage<TvPageProps> = ({ tv }) => {
|
|
return <TvDetails tv={tv} />;
|
|
};
|
|
|
|
export const getServerSideProps: GetServerSideProps<TvPageProps> = async (
|
|
ctx
|
|
) => {
|
|
const response = await axios.get<TvDetailsType>(
|
|
`http://${process.env.HOST || 'localhost'}:${process.env.PORT || 5055}/api/v1/tv/${ctx.query.tvId}`,
|
|
{
|
|
headers: ctx.req?.headers?.cookie
|
|
? { cookie: ctx.req.headers.cookie }
|
|
: undefined,
|
|
}
|
|
);
|
|
|
|
return {
|
|
props: {
|
|
tv: response.data,
|
|
},
|
|
};
|
|
};
|
|
|
|
export default TvPage;
|