nori-dongsan / nori-client

💚nori-dongsan💚 Client의 퍼레이드로 여러분을 초대합니다 🥳🥳🥳🥳
https://www.with-nori.com/
6 stars 2 forks source link

[ Intro ] 로그인 회원가입 모두 구현 완료 #104

Closed Happhee closed 2 years ago

Happhee commented 2 years ago

🔥 Related Issues

🎡 작업 내용

✅ PR Point

📄 login.tsx

Too many redirect라는 오류가 계속뜨는 이유는 session을 ssr로 렌더링을 안하면 계속해서 요청하기 때문에 이를 적용해주었다

import { GetServerSideProps, InferGetServerSidePropsType } from 'next';

export default function login({
  data,
}: InferGetServerSidePropsType<typeof getServerSideProps>) {

}
export const getServerSideProps: GetServerSideProps = async (context) => {
  const session = await getSession({ req: context.req });
  return {
    props: {
      data: { session },
    },
  };
};