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: useAuthValidation hook 구현, MemeLongPressContainer 컴포넌트로 감싸기 #113

Merged
merged 8 commits into from
Feb 22, 2023

Conversation

ojj1123
Copy link
Collaborator

@ojj1123 ojj1123 commented Feb 22, 2023

📮 관련 이슈

⛳️ 작업 내용

🌱 PR 포인트

  • useAuthValidation hook 구현
    • 네이밍과 타입 추론 등 리뷰 부탁드립니다.
export const useAuthValidation = () => {
  const { isLogin } = useAuth();
  const modalProps = useSignUpModalContext();

  const validate = useCallback(
    <T extends Handler>(handler: T, options: ValidatorOptions = { needSignUpModal: true }) =>
      (...args: Parameters<T>) => {
        if (isLogin) return handler(args) as ReturnType<T>;
        if (!isLogin && options.needSignUpModal) return modalProps.onOpen();
      },
    [isLogin, modalProps],
  );

  return { validate };
};
  • SignUpModal 상태 전역 상태로 관리

    • context 구현
    • _app.tsxSignUpModal 컴포넌트 하나만 추가
  • 유저 정보 typo 수정

    • shareCollectionId -> sharedCollectionId

📸 스크린샷

스크린샷 스크린샷
파일첨부바람 파일첨부바람

📎 레퍼런스

@ojj1123 ojj1123 self-assigned this Feb 22, 2023
@vercel
Copy link

vercel bot commented Feb 22, 2023

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

Name Status Preview Comments Updated
21st-web-team-1-fe ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 22, 2023 at 9:33AM (UTC)

@ojj1123 ojj1123 marked this pull request as ready for review February 22, 2023 08:23
Copy link
Member

@elbica elbica left a comment

Choose a reason for hiding this comment

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

어지러운 WithAuthHandler 리팩토링 감사합니다😊😊

- validate 함수 타입 추론
- validate 함수 옵션 추가(Thanks @elbica)
@ojj1123 ojj1123 merged commit 873243a into develop Feb 22, 2023
@ojj1123 ojj1123 deleted the feature/issue-109-111 branch February 22, 2023 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MemeLongPressContainer 컴포넌트 감싸기
2 participants