Skip to content

Commit

Permalink
Merge pull request #112 from YAPP-Github/qa/workbook-111
Browse files Browse the repository at this point in the history
[ Qa/workbook 111 ] workbook qa
  • Loading branch information
soomin9106 authored Jul 12, 2024
2 parents 70f4be3 + a85bbeb commit f90f43c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/app/workbook/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useQuery } from "@tanstack/react-query";

import TitleSection from "@shared/components/TitleSection";

import { ClientSubscribePopup } from "@workbook/components/ClientSubscribePopup";
import CurriculumSection from "@workbook/components/CurriculumSection";
import OverviewSection from "@workbook/components/OverviewSection";
import WorkbookSkeleton from "@workbook/components/WorkbookSkeleton";
Expand Down Expand Up @@ -41,7 +40,6 @@ export default function WorkbookPage() {
return (
<main className="flex h-[100vh] w-full flex-col items-center overflow-x-hidden">
<article className="flex h-full w-full max-w-screen-sm flex-col space-y-[24px] overflow-y-scroll">
<ClientSubscribePopup />
{workbookInfo && (
<>
<figure>
Expand Down
5 changes: 3 additions & 2 deletions src/subscription/constants/subscribe.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const SUBSCRIBE_TITLES = {
SUBSCRIBE_TITLE_1: "매일 아침마다",
SUBSCRIBE_TITLE_2: "경제 아티클과 문제를 보내드려요!",
SUBSCRIBE_TITLE_FEW: "FEW는 매일 경제 아티클과 문제를 보내드려요!"
SUBSCRIBE_TITLE_FEW: "매일 아티클과 문제를 보내드려요!"
}
export const EMAIL_CONTROL = {
EMAIL_PLACEHOLDER: "이메일을 입력해주세요",
Expand All @@ -17,5 +17,6 @@ export const SUBSCRIBE_USER_ACTIONS = {
SUBSCRIBE_REJECT: "좀 더 둘러볼래요",
SUBSCRIBE_ACCEPT: "구독할게요",
SUBSCRIBE_SUCCESS: "구독 신청이 완료되었어요!",
SUBSCRIBE_CONFIRM: "구독하기"
SUBSCRIBE_FAIL: "구독 신청이 되지 않았습니다.",
SUBSCRIBE_CONFIRM: "이 학습지 구독하기"
}
13 changes: 10 additions & 3 deletions src/subscription/hooks/useSubscribeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useForm } from 'react-hook-form';

import { useMutation } from '@tanstack/react-query';

import axios from 'axios';

import { useToast } from '@shared/components/ui/use-toast';
import useWorkbookId from '@shared/hooks/useWorkbookId';

Expand Down Expand Up @@ -43,15 +45,20 @@ export const useSubscribeForm = () => {
});
},
onError: (error) => {
console.error(error);
let errorMessage = SUBSCRIBE_USER_ACTIONS.SUBSCRIBE_FAIL;
if (axios.isAxiosError(error) && error.response) {
errorMessage = error.response.data.message || errorMessage;
}
toast({
title: '구독 신청이 되지 않았습니다.'
title: errorMessage,
});
},
});
} catch (error) {
console.error('catch error', error);

toast({
title: '구독 신청이 되지 않았습니다.'
title: SUBSCRIBE_USER_ACTIONS.SUBSCRIBE_FAIL
});
}
};
Expand Down

0 comments on commit f90f43c

Please sign in to comment.