Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(login): 로그인 퍼널 구현 #42

Merged
merged 26 commits into from
Aug 29, 2024
Merged

feat(login): 로그인 퍼널 구현 #42

merged 26 commits into from
Aug 29, 2024

Conversation

Collection50
Copy link
Member

1. 무슨 이유로 코드를 변경했나요?

  • 로그인 퍼널을 구현했습니다.

2. 어떤 위험이나 장애를 발견했나요?

  • 로그인 시 500에러가 발생합니다 (BE와 논의 완료 후 머지 예정입니다.)

3. 관련 스크린샷을 첨부해주세요.


4. 완료 사항


5. 추가 사항 / 코드 리뷰 받고 싶은 부분

  • 셀프 리뷰로 남기겠습니다.
  • 첫 로그인이 아닌 경우(포지션을 미리 선택한 경우)를 저장하는 로직이 추가적으로 필요합니다. (with BE)

Copy link

vercel bot commented Aug 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bbo-gak-client ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 29, 2024 8:54am

Comment on lines 5 to 13
export default async function AuthRedirect({ children }: StrictPropsWithChildren) {
const session = await auth();

return (
<Redirect condition={session?.accessToken != null} to="/login">
{children}
</Redirect>
);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로그인 여부를 확인해, 리다이렉트를 설정하는 선언형 컴포넌트입니다.

Comment on lines 1 to 5
'use server';

import { signIn } from '@/auth';

export const googleLogin = () => signIn('google', { redirectTo: '/login?auth=select' });
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auth.js가 next/header를 사용하고 있어, action으로 export하여 별도로 사용합니다.

client에서 server action을 사용하게 하는 nextJs에서 권장 방법입니다.

Comment on lines +9 to +18
export function Redirect({ children, to = '/', condition }: Props) {
if (typeof condition === 'function' && condition()) {
redirect(to);
}

if (condition) {
redirect(to);
}
return <>{children}</>;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

클라이언트에서 Redirect를 선언적으로 사용하는 컴포넌트입니다.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funnel을 간소화하여 서비스에 맞게 구현했습니다.

Comment on lines +32 to +43
width: px0To2000,
height: px0To2000,
borderWidth: px0To10,
fontSize: {
...px0To100,
...typographyToken,
},
fontWeight: fontWeightToken,
lineHeight: px0To100,
minWidth: px0To500,
minHeight: px0To500,
spacing: px0To500,
minWidth: px0To2000,
minHeight: px0To2000,
spacing: px0To2000,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2000px까지 arbitrary 없이 사용할 수 있도록 변경했습니다.
빌드 시점에 계산되므로, 런타임 오버헤드가 발생하지 않습니다.

import Google from 'next-auth/providers/google';
import { postLogin } from './app/login/api/postLogin';

export const { handlers, signIn, signOut, auth } = NextAuth({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NextAuth를 통해 로그인한 유저의 정보도 저장할 수 있는거로 알고 있는데, 해당 기능도 추가되면 좋을 것 같아요!

Copy link
Member Author

@Collection50 Collection50 Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유저 정보는 useSession API를 통해 접근할 수 있습니다

transition={{ duration: 0.6, ease: 'easeOut' }}
className="w-552 h-604 p-68 pt-116 flex flex-col justify-center gap-56 rounded-30 bg-[white]">
<div className="flex flex-col items-center gap-16">
<h1 className="text-36 font-bold">환영해요 조혜원님!</h1>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유저 정보 가져오는게 가능하면 이 부분 유저 이름으로 바꿔야될 것 같아요~

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

좋아요 !

@Collection50 Collection50 merged commit 50db295 into main Aug 29, 2024
3 checks passed
eunbeann pushed a commit that referenced this pull request Aug 29, 2024
* login

* feat

* fix

* f

* fix

* f

* fix

* f

* fix

* f

* fix

* fix

* fix

* f

* f

* f

* f

* fix:

* f

* fix

* f

* FIX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants