NextJSNetflix/pages/index.tsx

29 lines
533 B
TypeScript
Raw Normal View History

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"
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() {
return (
2023-06-04 12:33:10 +00:00
<>
2023-06-26 14:50:04 +00:00
<Navbar />
2023-06-04 12:33:10 +00:00
</>
2023-06-03 09:45:49 +00:00
)
}