NextJSNetflix/pages/index.tsx

37 lines
830 B
TypeScript
Raw Permalink Normal View History

2023-08-18 12:00:58 +00:00
import Billboard from "@/components/Billboard"
import MovieList from "@/components/MovieList"
2023-06-26 14:50:04 +00:00
import Navbar from "@/components/Navbar"
2023-06-04 12:33:10 +00:00
import useCurrentUser from "@/hooks/useCurrentUser"
2023-08-18 12:00:58 +00:00
import useMoviesList from "@/hooks/useMoviesList"
2023-06-04 12:33:10 +00:00
import { NextPageContext } from "next"
import { signOut,getSession } from "next-auth/react"
export async function getServerSideProps(context: NextPageContext){
const session = await getSession(context)
if(!session){
return {
redirect: {
destination: '/auth',
permanent: false,
},
}
}
return {
props: {}
}
}
2023-06-03 09:45:49 +00:00
export default function Home() {
2023-08-18 12:00:58 +00:00
const { data: film = [] } = useMoviesList();
2023-06-03 09:45:49 +00:00
return (
2023-06-04 12:33:10 +00:00
<>
2023-06-26 14:50:04 +00:00
<Navbar />
2023-08-18 12:00:58 +00:00
<Billboard />
2023-08-18 13:27:23 +00:00
<div className="pb-40">
2023-08-18 12:00:58 +00:00
<MovieList title="Popolari" data={film} />
</div>
2023-06-04 12:33:10 +00:00
</>
2023-06-03 09:45:49 +00:00
)
}