-
Notifications
You must be signed in to change notification settings - Fork 3
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] 로그인 & 회원가입 구현 #93
The head ref may contain hidden characters: "82-feat-\uB85C\uADF8\uC778-\uD68C\uC6D0\uAC00\uC785-\uAD6C\uD604"
Conversation
package.json
Outdated
@@ -24,6 +24,7 @@ | |||
"react-colorful": "^5.6.1", | |||
"react-dom": "^18", | |||
"react-hook-form": "^7.51.4", | |||
"react-router-dom": "^6.23.1", |
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.
next.js에서 react-router-dom사용은 좀 찾아보니까 일반적이진 않은거같아요
충돌문제도 있고 해서 이건 다른 방법을 찾아보거나,
주강사님이나 멘토님이 사용 ok하면 사용하는게 좋을거같스빈다
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.
보니까 router-dom 설치만 하고 사용은 안한 것 같네요 useRouter 때문에 깔았던 것 같은데 'next/navigation'에 있는 useRouter로 사용했어요! 이 부분 uninstall 하겠습니다!
public/index.ts
Outdated
@@ -4,6 +4,11 @@ export { default as EyeOffIcon } from './svgs/eyeOff.svg'; | |||
export { default as EyeOnIcon } from './svgs/eyeOn.svg'; | |||
export { default as LogoIcon } from './svgs/logo.svg'; | |||
export { default as SearchIcon } from './svgs/search.svg'; | |||
|
|||
export { default as GitIcon } from '@/public/svgs/gitHub.svg'; |
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.
export { default as GitIcon } from '@/public/svgs/gitHub.svg'; | |
export { default as GitIcon } from '@/public/svgs/github.svg'; |
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.
github 아이콘과 git 아이콘은 서로 다른걸로 알고있어요 더 명확히 사용하는게 좋을거같읍니다
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/api/authAPI.ts
Outdated
@@ -0,0 +1,51 @@ | |||
import { FetchSigninInfoTypes } from '@/types'; |
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.
import { FetchSigninInfoTypes } from '@/types'; | |
import type { FetchSigninInfoTypes } from '@/types'; |
src/api/authAPI.ts
Outdated
const data = await response.json(); | ||
return data; | ||
} catch (error) { | ||
throw new Error('회원가입 실패!'); |
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.
catch로 error을 받아오도록 만드셨으면 new Error을 생성할 필요 없이
catch로 들어오는 error을 던져줘도 되요
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.
오호,, 그게 더 간단하겠네요!
headers: { | ||
accept: 'application/json', | ||
}, | ||
body: formData, | ||
}); |
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.
headers: { | |
accept: 'application/json', | |
}, | |
body: formData, | |
}); | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
body: JSON.stringify(formData), | |
}); |
이렇게 보내야하지 않나요? 처음보는 방식이네유
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.
보내는 바디 형식이 form-data 형식이라 저렇게 보냈어요!! 혹시 몰라서 Json.stringify로 시도해봤는데 에러 뜨네욤,,
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.
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.
아 네넵 그러네요 header의 content type 으로 json이 들어가면 안되겠네요! 이 부분은 Formdata 타입으로 맞춰놓겠습니다!
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.
요소가 form보다는 checkbox에 더 가까운거같아요
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.
네넵 네이밍 수정 하겠습니다
.not-checked { | ||
color: red; | ||
} |
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.
글로벌 변수로 사용가능할거같아요
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.
inputs가 아니라 form이 되어야 맞는거같아요
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.
이렇게 가는건 어떠신가요?
- Signup -> SignupForm
- SignupInputs는 그대로
SignupForm으로 바꾸면 Signup 컴포넌트 이름이 애매해져서 이런 식으로 생각해봤습니다!
isAgreementAllChecked: boolean; | ||
setIsAllValid: Dispatch<SetStateAction<boolean>>; | ||
} | ||
export default forwardRef<HTMLFormElement, SignupInputProps>(function SignupInputs( |
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.
혹시 forwardRef가 필요한 경우가 있을까요?
외부에서 참조하고있는것 같지 않아서 여쭤옵니다
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.
현재 Signup 컴포넌트에서 ref 참조하고 있습니다! 회원가입의 폼 제출 버튼은 SignupInputs 컴포넌트의 외부에 있기 때문에 ref를 통해 form을 참조함으로써 외부로부터 제출이 가능하게끔 만들었습니다!
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.
일반적인 네이밍이 아닌거같아요
🚀 작업 내용
📝 참고 사항
fill 처리 해두었습니다.
🖼️ 스크린샷
🚨 관련 이슈 (이슈 번호)
✅ 체크리스트