Files
requestarr/src/pages/tv/[tvId]/index.tsx
Ryan Cohen 16545eec22 feat: tooltip foundation (#2950)
* feat: add foundation for tooltips

* fix: add lang

* refactor: remove React import where no longer necessary
2022-08-19 19:35:50 +09:00

37 lines
775 B
TypeScript

import axios from 'axios';
import type { NextPage } from 'next';
import type { TvDetails as TvDetailsType } from '../../../../server/models/Tv';
import TvDetails from '../../../components/TvDetails';
interface TvPageProps {
tv?: TvDetailsType;
}
const TvPage: NextPage<TvPageProps> = ({ tv }) => {
return <TvDetails tv={tv} />;
};
TvPage.getInitialProps = async (ctx) => {
if (ctx.req) {
const response = await axios.get<TvDetailsType>(
`http://localhost:${process.env.PORT || 5055}/api/v1/tv/${
ctx.query.tvId
}`,
{
headers: ctx.req?.headers?.cookie
? { cookie: ctx.req.headers.cookie }
: undefined,
}
);
return {
tv: response.data,
};
}
return {};
};
export default TvPage;