mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-06 22:58:09 -05:00
* build: bump deps and add some new eslint rules * refactor: run eslint --fix on code to convert to type imports where possible
37 lines
861 B
TypeScript
37 lines
861 B
TypeScript
import axios from 'axios';
|
|
import type { NextPage } from 'next';
|
|
import React from 'react';
|
|
import type { MovieDetails as MovieDetailsType } from '../../../../server/models/Movie';
|
|
import MovieDetails from '../../../components/MovieDetails';
|
|
|
|
interface MoviePageProps {
|
|
movie?: MovieDetailsType;
|
|
}
|
|
|
|
const MoviePage: NextPage<MoviePageProps> = ({ movie }) => {
|
|
return <MovieDetails movie={movie} />;
|
|
};
|
|
|
|
MoviePage.getInitialProps = async (ctx) => {
|
|
if (ctx.req) {
|
|
const response = await axios.get<MovieDetailsType>(
|
|
`http://localhost:${process.env.PORT || 5055}/api/v1/movie/${
|
|
ctx.query.movieId
|
|
}`,
|
|
{
|
|
headers: ctx.req?.headers?.cookie
|
|
? { cookie: ctx.req.headers.cookie }
|
|
: undefined,
|
|
}
|
|
);
|
|
|
|
return {
|
|
movie: response.data,
|
|
};
|
|
}
|
|
|
|
return {};
|
|
};
|
|
|
|
export default MoviePage;
|