mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-01 12:18:35 -05:00
feat(frontend/api): tv details page
This commit is contained in:
38
src/pages/tv/[tvId]/index.tsx
Normal file
38
src/pages/tv/[tvId]/index.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
import React from 'react';
|
||||
import { NextPage } from 'next';
|
||||
import axios from 'axios';
|
||||
import { parseCookies } from 'nookies';
|
||||
import TvDetails from '../../../components/TvDetails';
|
||||
import type { TvDetails as TvDetailsType } from '../../../../server/models/Tv';
|
||||
|
||||
interface TvPageProps {
|
||||
tv?: TvDetailsType;
|
||||
}
|
||||
|
||||
const TvPage: NextPage<TvPageProps> = ({ tv }) => {
|
||||
return <TvDetails tv={tv} />;
|
||||
};
|
||||
|
||||
TvPage.getInitialProps = async (ctx) => {
|
||||
if (ctx.req) {
|
||||
const cookies = parseCookies(ctx);
|
||||
const response = await axios.get<TvDetailsType>(
|
||||
`http://localhost:${process.env.PORT || 3000}/api/v1/tv/${
|
||||
ctx.query.tvId
|
||||
}${cookies.locale ? `?language=${cookies.locale}` : ''}`,
|
||||
{
|
||||
headers: ctx.req?.headers?.cookie
|
||||
? { cookie: ctx.req.headers.cookie }
|
||||
: undefined,
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
tv: response.data,
|
||||
};
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
|
||||
export default TvPage;
|
||||
9
src/pages/tv/[tvId]/recommendations.tsx
Normal file
9
src/pages/tv/[tvId]/recommendations.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import { NextPage } from 'next';
|
||||
import TvRecommendations from '../../../components/TvDetails/TvRecommendations';
|
||||
|
||||
const TvRecommendationsPage: NextPage = () => {
|
||||
return <TvRecommendations />;
|
||||
};
|
||||
|
||||
export default TvRecommendationsPage;
|
||||
9
src/pages/tv/[tvId]/similar.tsx
Normal file
9
src/pages/tv/[tvId]/similar.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import { NextPage } from 'next';
|
||||
import TvSimilar from '../../../components/TvDetails/TvSimilar';
|
||||
|
||||
const TvSimilarPage: NextPage = () => {
|
||||
return <TvSimilar />;
|
||||
};
|
||||
|
||||
export default TvSimilarPage;
|
||||
Reference in New Issue
Block a user