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

[ Bugfix/DEV-78 ] 로그인 상태에 따른 이벤트 분기 처리 및 테스트 코드 수정 #137

Merged
merged 4 commits into from
Aug 4, 2024

Conversation

Happhee
Copy link
Collaborator

@Happhee Happhee commented Aug 4, 2024

🔥 Related Issues

https://linear.app/fewletter/issue/DEV-78/메인-페이지-워크북-카드-로그인-예외처리-및-테스트-버그-수정

💜 작업 내용

  • 로그인 여부에 따라 버튼 핸들러 재정의
  • 테스트 버그 수정

✅ PR Point

workbookcardsWrapper.test.tsx

  • dynamic import 이후의 컴포넌트를 테스트 하기 위해서 await waitfor로 감싸주었습니다.

로그인상태에 따른 핸들러 분기처리

  • 구독상태일경우, 비로그인시에는 로그인/회원가입 페이지로 이동
 if (isLogin)
      postSubscribeWorkbook({
        workbookId: workbookId.toString(),
        handleSucess: () => {
          queryClient.refetchQueries({
            queryKey: [QUERY_KEY.GET_SUBSCRIBE_WORKBOOKS],
          });
          queryClient.refetchQueries({
            queryKey: [QUERY_KEY.GET_WORKBOOKS_WITH_CATEGORY],
          });
        },
      });
    else {
      push("/auth");
    }
  • 워크북 리스트 조회시, 로그인 여부에 따라 구독 쿼리 활성화 여부 제어
const workbookCardList = useQueries({
    queries: [
      getWorkbooksWithCategoryQueryOptions({
        code: code !== undefined ? code : ENTIRE_CATEGORY,
      }),
      {
        ...getSubscriptionWorkbooksQueryOptions(),
        enabled: isLogin,
      },

@soomin9106 soomin9106 changed the base branch from feature/DEV-76 to develop August 4, 2024 08:33
@soomin9106 soomin9106 merged commit e0118fa into develop Aug 4, 2024
3 checks passed
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