-
Notifications
You must be signed in to change notification settings - Fork 0
[week4/mission] 첫 커스텀 훅 만들어보기, 로그인 / 회원가입 기능 구현해보기 (feat. 유효성 검사) #23
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
Conversation
duwlsssss
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했어요 👍
| console.log("회원가입 성공: ", response.data); | ||
| navigate("/login"); | ||
| } catch (e) { | ||
| console.error("에러 발생: ", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나중에 에러를 시용자에게 어떻게 시각적으로 표현할지 생각해봐도 좋겠어용
| // 오류가 하나라도 있거나, 입력값이 비어있으면 버튼을 비활성화 | ||
| const isDisabled = | ||
| Object.values(errors || {}).some((error) => error.length > 0) || // 오류가 있으면 true | ||
| Object.values(values).some((value) => value === ""); // 입력값이 비어있으면 true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
에러 여부 변수로 뺀 거 좋아요!
| <div className="w-20 h-10 flex justify-center items-center rounded-md bg-black text-white cursor-pointer"> | ||
| 로그인 | ||
| </div> | ||
| <div className="w-20 h-10 flex justify-center items-center rounded-md bg-pink-600 text-white cursor-pointer"> | ||
| 회원가입 | ||
| </div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기 navigate가 빠졌어요!
| </div> | ||
| {/* 소셜 로그인 */} | ||
| <div className="w-60 h-10 flex items-center justify-between px-3 border-2 border-white rounded-md mb-5"> | ||
| <img src="/images/GoogleLogo.svg" alt="google_logo" className="w-6" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
애플리케이션 내부에서 동적으로 불러올 이미지는 src/assets/images 폴더 만들어서 넣는 게 좋을 것 같아요!
Vite를 쓸 때 src안에 있는 이미지는 Vite/Webpack이 최적화해서 번들링 최적화를 해주기 때문에
로고, favicon, Open Graph 등의 이미지 등만 public에 넣는 걸 추천합니당
| {step === "email" && ( | ||
| <EmailInput nextStep={() => setStep("password")} /> | ||
| )} | ||
| {step === "password" && ( | ||
| <PasswordInput nextStep={() => setStep("profile")} /> | ||
| )} | ||
| {step === "profile" && <ProfileInput />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
너무 깔끔해서 기절할 것 같아요...
| const schema = z | ||
| .object({ | ||
| email: z.string().email({ message: "올바른 이메일 형식이 아닙니다." }), | ||
| password: z | ||
| .string() | ||
| .min(8, { | ||
| message: "비밀번호는 8자 이상이어야 합니다.", | ||
| }) | ||
| .max(20, { | ||
| message: "비밀번호는 20자 이하이어야 합니다.", | ||
| }), | ||
| confirmPassword: z.string(), | ||
| name: z.string().min(1, { | ||
| message: "이름을 입력해주세요.", | ||
| }), | ||
| }) | ||
| .refine((data) => data.password === data.confirmPassword, { | ||
| path: ["confirmPassword"], | ||
| message: "비밀번호가 일치하지 않습니다.", | ||
| }); | ||
|
|
||
| export type FormFields = z.infer<typeof schema>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 파일에서 스키마 부분은 schema 폴더 만들어서 빼는 게 나을 것 같아요!
namgungseok12
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice job!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다~!!
✏️ 작업 내용
#️⃣ 연관된 이슈
#20
📷 작업 결과
💡 함께 공유하고 싶은 부분
🤔 질문
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트