From 9ae5afe940ef292a8633f8b2feb2b17f14d8cc00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=ED=98=B8?= Date: Mon, 1 Aug 2022 23:15:50 +0900 Subject: [PATCH 01/15] =?UTF-8?q?feat=20:=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20?= =?UTF-8?q?=EB=A7=8C=EB=A3=8C=EC=8B=9C=20=EB=A1=9C=EA=B7=B8=EC=95=84?= =?UTF-8?q?=EC=9B=83=20=EC=8B=9C=ED=82=A4=EB=8A=94=20=EA=B8=B0=EB=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/api/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 60727aa..cb996b0 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -20,4 +20,23 @@ apiClient.interceptors.request.use( return Promise.reject(error); }, ); + +apiClient.interceptors.response.use( + (response) => { + return response; + }, + async (error) => { + const { response } = error; + console.log(response.data.code); + switch (response.data.code) { + case 'INVALID_JWT': + alert('로그인 시간이 만료되었습니다. 다시 로그인 해주세요'); + Cookies.remove('AccessToken'); + window.location.href = `${(top as Window).location.href}/`; + break; + default: + break; + } + }, +); export default apiClient; From 6ccaca60ec361e73a870c7e85943dc0531393caa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=ED=98=B8?= Date: Mon, 1 Aug 2022 23:34:01 +0900 Subject: [PATCH 02/15] =?UTF-8?q?Fix=20:=20=EB=8D=B0=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=ED=86=B1=EC=97=90=EC=84=9C=20=EB=B0=B0=EA=B2=BD=20=EC=83=89?= =?UTF-8?q?=EA=B9=94=EC=9D=B4=20=EC=A7=A4=EB=A6=AC=EB=8A=94=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/Routing.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/router/Routing.tsx b/src/router/Routing.tsx index ffdbb83..d01345c 100644 --- a/src/router/Routing.tsx +++ b/src/router/Routing.tsx @@ -138,9 +138,23 @@ function Routing() { ); } const PageLayout = styled.div` + overflow: auto; background-color: ${palette.backgroundColor}; height: 100%; - /* position: relative; */ + &::-webkit-scrollbar { + width: 10px; + height: 10px; + } + &::-webkit-scrollbar-track { + background-color: ${palette.backgroundColor}; + border-radius: 0px 10px 10px 0; + } + &::-webkit-scrollbar-thumb { + background-color: ${palette.grayLight}; + border-radius: 12px; + background-clip: padding-box; + border: 1px solid transparent; + } `; const PageWrapper = styled.main` margin: 0 auto; From a0261d44269f2a23acbdf6c45fa58973c7406b8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=ED=98=B8?= Date: Mon, 1 Aug 2022 23:47:06 +0900 Subject: [PATCH 03/15] feat: getMyInfo API --- src/lib/api/user.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/api/user.ts b/src/lib/api/user.ts index 4fa56a6..c45c31a 100644 --- a/src/lib/api/user.ts +++ b/src/lib/api/user.ts @@ -26,3 +26,8 @@ export const postWithdrawal = async () => { const res = await apiClient.post('/withdrawal'); return res.data; }; + +export const getMyInfo = async () => { + const res = await apiClient.get('/myInfo'); + return res.data; +}; From e4d173d7566e6a0886d8d1f35542453c59e740ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=ED=98=B8?= Date: Mon, 1 Aug 2022 23:47:31 +0900 Subject: [PATCH 04/15] =?UTF-8?q?Refactor=20:=20useMyInfoLoad=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/header/MenuBlock.tsx | 17 ++++++----------- src/hooks/user/useMyInfoLoad.ts | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 src/hooks/user/useMyInfoLoad.ts diff --git a/src/components/header/MenuBlock.tsx b/src/components/header/MenuBlock.tsx index 093508c..a878206 100644 --- a/src/components/header/MenuBlock.tsx +++ b/src/components/header/MenuBlock.tsx @@ -1,15 +1,15 @@ -import React, { useEffect, useMemo, useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { Logo, Logout } from '@/assets/img'; import { palette } from '@/lib/styles/palette'; import styled from 'styled-components'; import DatingInfoBox from './DatingInfoBox'; import MeetingInfoBox from './MeetingInfoBox'; import { postLogout, postWithdrawal } from '@/lib/api/user'; -import { useDatingSessionState, useToggle } from '@/hooks/common'; +import { useToggle } from '@/hooks/common'; import { Modal } from '../base'; import Cookies from 'js-cookie'; import { useNavigate } from 'react-router-dom'; -import useUnivLoad from '@/hooks/survey/useUnivLoad'; +import useMyInfoLoad from '@/hooks/user/useMyInfoLoad'; interface MenuBlockProps { isMenu: boolean; @@ -18,16 +18,11 @@ interface MenuBlockProps { function MenuBlock({ isMenu, onToggleMenu }: MenuBlockProps) { const [errorMessage, setErrorMessage] = useState('에러가 발생했습니다😭 다시한번 시도해 주세요!'); + const { info } = useMyInfoLoad(); const [isConfirm, setConfirm] = useState(false); const [isModal, onToggleModal] = useToggle(); const [isErrorModal, onToggleErrorModal] = useToggle(); const navigate = useNavigate(); - const { initDatingState } = useDatingSessionState(); - const { univs } = useUnivLoad(); - - const myUnivLabel = useMemo(() => { - return univs.find(({ id }) => id === initDatingState.myUniversity)?.name; - }, [univs]); const handleLogout = async () => { try { @@ -64,8 +59,8 @@ function MenuBlock({ isMenu, onToggleMenu }: MenuBlockProps) { -
{initDatingState.kakaoId}
-
{myUnivLabel}
+
{info?.email}
+
{info?.university}
diff --git a/src/hooks/user/useMyInfoLoad.ts b/src/hooks/user/useMyInfoLoad.ts new file mode 100644 index 0000000..f346ce7 --- /dev/null +++ b/src/hooks/user/useMyInfoLoad.ts @@ -0,0 +1,20 @@ +import { getMyInfo } from '@/lib/api/user'; +import { useEffect, useState } from 'react'; + +const useMyInfoLoad = () => { + const [info, setInfo] = useState<{ email: 'string'; university: string }>(); + useEffect(() => { + const GetInfo = async () => { + try { + const response = await getMyInfo(); + setInfo(response); + } catch (e) { + console.log(e); + } + }; + GetInfo(); + }, []); + return { info }; +}; + +export default useMyInfoLoad; From 7a3bdcc8bc2603cfec9115e19d4fe52236bb30d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=ED=98=B8?= Date: Tue, 2 Aug 2022 20:07:09 +0900 Subject: [PATCH 05/15] =?UTF-8?q?Fix:=20=EB=B2=84=ED=8A=BC=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/IsAbroadSurvey.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pages/IsAbroadSurvey.tsx b/src/pages/IsAbroadSurvey.tsx index f827287..2b1b217 100644 --- a/src/pages/IsAbroadSurvey.tsx +++ b/src/pages/IsAbroadSurvey.tsx @@ -59,8 +59,10 @@ const IsAbroadSurvey = () => { handleNextClick={handleNextClick} > - 지금 한국이신가요? <br /> - 해외이신가요? + <strong> + 지금 한국이신가요? <br /> + 해외이신가요? + </strong> @@ -71,7 +73,7 @@ const IsAbroadSurvey = () => { const BtnWrapper = styled(FormWrapper)` display: flex; - margin-top: 0px; + margin-top: 71px; `; export default IsAbroadSurvey; From 90128355ba0f7f23bb22c8cb7be68288c0f77870 Mon Sep 17 00:00:00 2001 From: Jiyoung Kim Date: Tue, 2 Aug 2022 20:23:23 +0900 Subject: [PATCH 06/15] =?UTF-8?q?fix:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EC=9D=B8=EC=A6=9D=20edu.ca=EB=A1=9C=EB=A7=8C=20=EB=81=9D?= =?UTF-8?q?=EB=82=98=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/authMail/EmailForm.tsx | 2 +- src/utils/validations.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/authMail/EmailForm.tsx b/src/components/authMail/EmailForm.tsx index 507065c..d7eae7f 100644 --- a/src/components/authMail/EmailForm.tsx +++ b/src/components/authMail/EmailForm.tsx @@ -33,7 +33,7 @@ const EmailForm = ({ onSubmitAuthCode }: EmailFormProps) => { newErrors.email = '이메일을 입력해주세요'; return newErrors; } - if (email && !checkForm({ value: email, type: 'email' })) newErrors.email = '올바른 이메일 형식이 아닙니다'; + if (email && !checkForm({ value: email, type: 'email' })) newErrors.email = '교육용 이메일은 edu, ca 중 하나로 끝나야 합니다.'; return newErrors; }, }); diff --git a/src/utils/validations.ts b/src/utils/validations.ts index fd8bd40..fbb644d 100644 --- a/src/utils/validations.ts +++ b/src/utils/validations.ts @@ -7,7 +7,7 @@ interface checkFormProps { export const checkForm = ({ value, type }: checkFormProps) => { const regex = { - email: /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i, + email: /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.(edu|ca)$/i, }; if (type === 'email') { From de632a56db93e3768fddfcf97ba754b599405215 Mon Sep 17 00:00:00 2001 From: Jiyoung Kim Date: Tue, 2 Aug 2022 20:30:18 +0900 Subject: [PATCH 07/15] =?UTF-8?q?feat:=20ie=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/authMail/EmailForm.tsx | 2 +- src/utils/validations.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/authMail/EmailForm.tsx b/src/components/authMail/EmailForm.tsx index d7eae7f..05abcfb 100644 --- a/src/components/authMail/EmailForm.tsx +++ b/src/components/authMail/EmailForm.tsx @@ -33,7 +33,7 @@ const EmailForm = ({ onSubmitAuthCode }: EmailFormProps) => { newErrors.email = '이메일을 입력해주세요'; return newErrors; } - if (email && !checkForm({ value: email, type: 'email' })) newErrors.email = '교육용 이메일은 edu, ca 중 하나로 끝나야 합니다.'; + if (email && !checkForm({ value: email, type: 'email' })) newErrors.email = '교육용 이메일은 edu, ca, ie 중 하나로 끝나야 합니다.'; return newErrors; }, }); diff --git a/src/utils/validations.ts b/src/utils/validations.ts index fbb644d..78e6322 100644 --- a/src/utils/validations.ts +++ b/src/utils/validations.ts @@ -7,7 +7,7 @@ interface checkFormProps { export const checkForm = ({ value, type }: checkFormProps) => { const regex = { - email: /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.(edu|ca)$/i, + email: /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.(edu|ca|ie)$/i, }; if (type === 'email') { From 791fc4c45d62d479af6527b57d15dea05a712fce Mon Sep 17 00:00:00 2001 From: Jiyoung Kim Date: Tue, 2 Aug 2022 20:40:44 +0900 Subject: [PATCH 08/15] =?UTF-8?q?feat:=20prev,=20next=20=EB=88=84=EB=A5=B4?= =?UTF-8?q?=EB=A9=B4=20=ED=99=88=EC=9C=BC=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/AuthMail.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/AuthMail.tsx b/src/pages/AuthMail.tsx index f5d86ce..e83b2e0 100644 --- a/src/pages/AuthMail.tsx +++ b/src/pages/AuthMail.tsx @@ -11,7 +11,6 @@ import { postEmail, putEmail } from '@/lib/api/email'; import Cookies from 'js-cookie'; const AuthMail = () => { - const [cantMoveNext] = useState(true); const [email, setEmail] = useState(''); const [isModal, onToggleModal] = useToggle(); const [isErrorModal, onToggleErrorModal] = useToggle(); @@ -56,9 +55,13 @@ const AuthMail = () => { } }; + const handlePrevNextClick = () => { + navigate('/'); + }; + return ( <> - + <strong> 신원 확인을 위해 <br /> From 0df93bc77dbba28d93467d47c873b33c670bba4c Mon Sep 17 00:00:00 2001 From: Jiyoung Kim <kimm.jeongs@gmail.com> Date: Tue, 2 Aug 2022 20:42:54 +0900 Subject: [PATCH 09/15] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=9D=B4=ED=9B=84=20=ED=99=88?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/domain/landing/LandingContainer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/domain/landing/LandingContainer.tsx b/src/components/domain/landing/LandingContainer.tsx index d783966..6a94e85 100644 --- a/src/components/domain/landing/LandingContainer.tsx +++ b/src/components/domain/landing/LandingContainer.tsx @@ -55,7 +55,7 @@ function LandingContainer() { variant={'default'} onClick={() => { const authenticated = Cookies.get('authenticated') === 'true'; - authenticated ? navigate('/type-of-meeting') : navigate('/auth-mail'); + authenticated ? navigate('/') : navigate('/auth-mail'); }} > 시작하기 From b05283394d83c148fdcbd947f37c9c969205b49b Mon Sep 17 00:00:00 2001 From: Jiyoung Kim <kimm.jeongs@gmail.com> Date: Tue, 2 Aug 2022 20:48:10 +0900 Subject: [PATCH 10/15] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8,=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EC=9D=B8=EC=A6=9D=20=EC=9D=B4=ED=9B=84=20=ED=99=88=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/AuthMail.tsx | 3 ++- src/pages/OauthKakao.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/AuthMail.tsx b/src/pages/AuthMail.tsx index e83b2e0..ad9dae0 100644 --- a/src/pages/AuthMail.tsx +++ b/src/pages/AuthMail.tsx @@ -9,6 +9,7 @@ import { useNavigate } from 'react-router-dom'; import { useToggle } from '@/hooks/common'; import { postEmail, putEmail } from '@/lib/api/email'; import Cookies from 'js-cookie'; +import Path from '@/router/Path'; const AuthMail = () => { const [email, setEmail] = useState(''); @@ -20,7 +21,7 @@ const AuthMail = () => { useEffect(() => { const authenticated = Cookies.get('authenticated') === 'true'; - authenticated && navigate('/type-of-meeting'); + authenticated && navigate(Path.LandingPage); }, []); const onSubmitAuthCode = async (email: string) => { diff --git a/src/pages/OauthKakao.tsx b/src/pages/OauthKakao.tsx index 49990a2..aff92e8 100644 --- a/src/pages/OauthKakao.tsx +++ b/src/pages/OauthKakao.tsx @@ -16,7 +16,7 @@ const OauthKakao = () => { try { const data = await getKakaoLoginInfo(); setKakaoLoginInfo(data); - data.authenticated ? navigate(Path.LandingPage) : navigate(Path.AuthMail); + navigate(Path.LandingPage); } catch (error) { console.log(error); } From 32e4af632733c12440a3074b7f83f7fad59992f9 Mon Sep 17 00:00:00 2001 From: choisohyun <sohyun4283@naver.com> Date: Tue, 2 Aug 2022 20:51:36 +0900 Subject: [PATCH 11/15] =?UTF-8?q?fix:=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EC=95=84=EC=9D=B4=EC=BD=98=20=EB=A7=81=ED=81=AC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95,=20=EB=AF=B8=ED=8C=85(=EC=B6=9C=EC=8B=A0=20=ED=95=99?= =?UTF-8?q?=EA=B5=90)=20#6=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=AC=B8?= =?UTF-8?q?=EA=B5=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/domain/landing/LandingFooter.tsx | 2 +- src/pages/OurUniversitiesSurvey.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/domain/landing/LandingFooter.tsx b/src/components/domain/landing/LandingFooter.tsx index 1d3ff86..3fae6c1 100644 --- a/src/components/domain/landing/LandingFooter.tsx +++ b/src/components/domain/landing/LandingFooter.tsx @@ -32,7 +32,7 @@ function LandingFooter() { <IconStyled src={KakaoIcon} onClick={() => { - window.open('http://pf.kakao.com/_XUkxkb', '_blank'); + window.open('http://pf.kakao.com/_XyXIxj/chat', '_blank'); }} /> <IconStyled diff --git a/src/pages/OurUniversitiesSurvey.tsx b/src/pages/OurUniversitiesSurvey.tsx index 1fd245c..cf6c287 100644 --- a/src/pages/OurUniversitiesSurvey.tsx +++ b/src/pages/OurUniversitiesSurvey.tsx @@ -59,7 +59,7 @@ const OurUniversitiesSurvey = () => { 모두 입력해주세요. Date: Tue, 2 Aug 2022 20:54:03 +0900 Subject: [PATCH 12/15] =?UTF-8?q?refactor:=20=ED=95=98=EB=93=9C=EC=BD=94?= =?UTF-8?q?=EB=94=A9=EB=A7=90=EA=B3=A0=20Path=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EB=B6=88=EB=9F=AC=EC=98=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/domain/landing/LandingContainer.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/domain/landing/LandingContainer.tsx b/src/components/domain/landing/LandingContainer.tsx index 6a94e85..b263c87 100644 --- a/src/components/domain/landing/LandingContainer.tsx +++ b/src/components/domain/landing/LandingContainer.tsx @@ -8,6 +8,7 @@ import { useLoginState } from '@/atoms/userState'; import { goKakaoLogin } from '@/utils/goKakaoLogin'; import Cookies from 'js-cookie'; import { HeaderWrapper } from '@/components/domain/survey/SurveyTemplate'; +import Path from '@/router/Path'; function LandingContainer() { const navigate = useNavigate(); @@ -24,7 +25,7 @@ function LandingContainer() { }; const checkAuthRedirect = ({ startSurvey = true }: { startSurvey?: boolean }) => { - isAuth ? (startSurvey ? navigate('/type-of-meeting') : navigate('/matching/meeting')) : navigate('/auth-mail'); + isAuth ? (startSurvey ? navigate(Path.TypeOfMeeting) : navigate(Path.MatchingMeeting)) : navigate('/auth-mail'); }; return ( @@ -55,7 +56,7 @@ function LandingContainer() { variant={'default'} onClick={() => { const authenticated = Cookies.get('authenticated') === 'true'; - authenticated ? navigate('/') : navigate('/auth-mail'); + authenticated ? navigate(Path.TypeOfMeeting) : navigate(Path.AuthMail); }} > 시작하기 From b98ae1a8688c46feddf5314c14e6e777f3c8501d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=ED=98=B8?= Date: Tue, 2 Aug 2022 20:58:09 +0900 Subject: [PATCH 13/15] =?UTF-8?q?refactor:=20=EB=B0=94=EB=80=90=20api=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=EC=97=90=20=EB=A7=9E=EC=B6=B0=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/api/dating.ts | 5 +++-- src/lib/api/meeting.ts | 4 ++-- src/types/dating.ts | 11 +---------- src/types/meeting.ts | 9 +++++---- 4 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/lib/api/dating.ts b/src/lib/api/dating.ts index 08b66e9..2958b6d 100644 --- a/src/lib/api/dating.ts +++ b/src/lib/api/dating.ts @@ -1,9 +1,10 @@ import apiClient from './index'; -import { Dating, DatingMatchingResultResponse } from '@/types/dating'; +import { Dating } from '@/types/dating'; import { AxiosResponse } from 'axios'; +import { MatchingResultResponse } from '@/types/meeting'; export const getDatingMatching = async () => { - const res = await apiClient.get('/dating/matching'); + const res = await apiClient.get('/dating/matching'); return res.data; }; diff --git a/src/lib/api/meeting.ts b/src/lib/api/meeting.ts index 097efba..7ed9e52 100644 --- a/src/lib/api/meeting.ts +++ b/src/lib/api/meeting.ts @@ -1,5 +1,5 @@ import apiClient from './index'; -import { Meeting, MeetingMatchingResultResponse } from '@/types/meeting'; +import { Meeting, MatchingResultResponse } from '@/types/meeting'; import { AxiosResponse } from 'axios'; export const postMeetingSurvey = async (payload: Meeting) => { @@ -28,6 +28,6 @@ export const postMeetingMatching = async () => { }; export const getMeetingMatching = async () => { - const res = await apiClient.get('/meeting/matching'); + const res = await apiClient.get('/meeting/matching'); return res.data; }; diff --git a/src/types/dating.ts b/src/types/dating.ts index 119ee93..5fe9ddb 100644 --- a/src/types/dating.ts +++ b/src/types/dating.ts @@ -1,4 +1,4 @@ -import { type Gender, Departments, DomesticAreas, Channel, Play, MindSet, TypeOfMeeting } from './meeting'; +import { type Gender, Departments, DomesticAreas, Channel, TypeOfMeeting } from './meeting'; export type Characteristic = 'VERY_QUIET' | 'A_LITTLE_QUIET' | 'VERY_ACTIVE' | 'A_LITTLE_ACTIVE'; export type Body = 'SKINNY' | 'SLIM' | 'MUSCULAR' | 'CHUBBY'; @@ -42,14 +42,6 @@ code : 7005 - 매칭에 실패한 상태 code : 7006 - 상대방 탈퇴로 인한 매칭 취소 상태 */ -type Code = 7000 | 7001 | 7002 | 7003 | 7004 | 7005 | 7006; - -export interface DatingMatchingResultResponse { - code: Code; - message: string; - partnerSurvey: DatingPartnerSurvey; -} - export interface DatingPartnerSurvey { age: number; areas: string[]; @@ -61,5 +53,4 @@ export interface DatingPartnerSurvey { isSmoke: boolean; kakaoId: string; university: string; - payDeadline: string; } diff --git a/src/types/meeting.ts b/src/types/meeting.ts index 70c5ddc..b44bc76 100644 --- a/src/types/meeting.ts +++ b/src/types/meeting.ts @@ -1,4 +1,4 @@ -import { Body, Characteristic } from '@/types/dating'; +import { DatingPartnerSurvey } from '@/types/dating'; export type Gender = 'MALE' | 'FEMALE'; export type TypeOfMeeting = 'ONE' | 'TWO' | 'THREE' | 'FOUR'; @@ -43,10 +43,12 @@ code : 7006 - 상대방 탈퇴로 인한 매칭 취소 상태 type Code = 7000 | 7001 | 7002 | 7003 | 7004 | 7005 | 7006; -export interface MeetingMatchingResultResponse { +export interface MatchingResultResponse { code: Code; message: string; - partnerSurvey: MeetingPartnerSurvey; + partnerSurvey: MeetingPartnerSurvey | DatingPartnerSurvey; + payDeadLine: string; + payName: string; } export interface MeetingPartnerSurvey { @@ -58,5 +60,4 @@ export interface MeetingPartnerSurvey { mindset: MindSet | ''; play: Play | ''; universities: string; - payDeadline: string; } From 3be4d0edf53bb1f071982fa70f390f8b8fe86a5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=ED=98=B8?= Date: Tue, 2 Aug 2022 20:58:34 +0900 Subject: [PATCH 14/15] =?UTF-8?q?Feat:=20=EB=A7=A4=EC=B9=AD=EC=8B=9C=20?= =?UTF-8?q?=EC=9E=85=EA=B8=88=EC=9E=90=20=EC=9D=B4=EB=A6=84=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/matching/MatchingTemplete.tsx | 65 +++++++++---------- .../domain/matching/buttons/SuccessButton.tsx | 9 ++- src/pages/MatchingPage.tsx | 22 +++---- 3 files changed, 49 insertions(+), 47 deletions(-) diff --git a/src/components/domain/matching/MatchingTemplete.tsx b/src/components/domain/matching/MatchingTemplete.tsx index a6ce4d4..fd1b3d3 100644 --- a/src/components/domain/matching/MatchingTemplete.tsx +++ b/src/components/domain/matching/MatchingTemplete.tsx @@ -9,41 +9,41 @@ import { Status } from '@/pages/MatchingPage'; import { getMeetingMatching } from '@/lib/api/meeting'; import { getDatingMatching } from '@/lib/api/dating'; import { useToggle } from '@/hooks/common'; -import { MeetingPartnerSurvey } from '@/types/meeting'; -import { DatingPartnerSurvey } from '@/types/dating'; +import { MatchingResultResponse } from '@/types/meeting'; interface MatchingTemplateProps { - meeting: (matchingResult: MeetingPartnerSurvey) => ReactNode; - dating: (matchingResult: DatingPartnerSurvey) => ReactNode; + meeting: (matchingResult: MatchingResultResponse) => ReactNode; + dating: (matchingResult: MatchingResultResponse) => ReactNode; title: ReactNode; btnName: string; handleStatus: (status: Status) => void; } -const initMeetingSurvey: MeetingPartnerSurvey = { - areas: [], - averageAge: 0, - averageHeight: 0, - departments: [], - kakaoId: '', - mindset: '', - play: '', - universities: '', - payDeadline: '', +const initMeetingSurvey: MatchingResultResponse = { + code: 7000, + message: '', + partnerSurvey: { areas: [], averageAge: 0, averageHeight: 0, departments: [], kakaoId: '', mindset: '', play: '', universities: '' }, + payDeadLine: '', + payName: '', }; -const initDatingSurvey: DatingPartnerSurvey = { - age: 0, - areas: [], - body: '', - characteristic: '', - dateCount: '', - department: '', - height: 0, - isSmoke: false, - kakaoId: '', - university: '', - payDeadline: '', +const initDatingSurvey: MatchingResultResponse = { + code: 7000, + message: '', + partnerSurvey: { + age: 0, + areas: [], + body: '', + characteristic: '', + dateCount: '', + department: '', + height: 0, + isSmoke: false, + kakaoId: '', + university: '', + }, + payDeadLine: '', + payName: '', }; const MatchingTemplete = ({ meeting, dating, btnName, title, handleStatus }: MatchingTemplateProps) => { @@ -52,8 +52,8 @@ const MatchingTemplete = ({ meeting, dating, btnName, title, handleStatus }: Mat const navigate = useNavigate(); const [isErrorModal, onToggleErrorModal] = useToggle(); const [errorMessage, setErrorMessage] = useState(''); - const [meetingMatchingResult, setMeetingMatchingResult] = useState(initMeetingSurvey); - const [datingMatchingResult, setDatingMatchingResult] = useState(initDatingSurvey); + const [meetingMatchingResult, setMeetingMatchingResult] = useState(initMeetingSurvey); + const [datingMatchingResult, setDatingMatchingResult] = useState(initDatingSurvey); useEffect(() => { location.pathname.includes('meeting') ? setType('meeting') : setType('dating'); @@ -72,7 +72,6 @@ const MatchingTemplete = ({ meeting, dating, btnName, title, handleStatus }: Mat const fetchMatchingResult = async () => { try { const response = type === 'meeting' ? await getMeetingMatching() : await getDatingMatching(); - const { code } = response; switch (code) { case 7000: @@ -88,7 +87,7 @@ const MatchingTemplete = ({ meeting, dating, btnName, title, handleStatus }: Mat handleStatus('femaleSuccess'); break; case 7004: - saveMatchingResult(response.partnerSurvey); + saveMatchingResult(response); handleStatus('end'); break; case 7005: @@ -98,12 +97,12 @@ const MatchingTemplete = ({ meeting, dating, btnName, title, handleStatus }: Mat handleStatus('cancel'); } } catch (e) { - setErrorMessage(() => e.response.data.message); + setErrorMessage(() => (e as any).response.data.message); onToggleErrorModal(); } }; - const saveMatchingResult = (partnerSurvey: MeetingPartnerSurvey | DatingPartnerSurvey) => { + const saveMatchingResult = (partnerSurvey: MatchingResultResponse) => { 'age' in partnerSurvey ? setDatingMatchingResult(partnerSurvey) : setMeetingMatchingResult(partnerSurvey); }; @@ -140,7 +139,7 @@ const MatchingTemplete = ({ meeting, dating, btnName, title, handleStatus }: Mat { { none: , - success: , + success: , femaleSuccess: , pay: , end: , diff --git a/src/components/domain/matching/buttons/SuccessButton.tsx b/src/components/domain/matching/buttons/SuccessButton.tsx index 22e3aa7..851dd64 100644 --- a/src/components/domain/matching/buttons/SuccessButton.tsx +++ b/src/components/domain/matching/buttons/SuccessButton.tsx @@ -5,7 +5,11 @@ import styled from 'styled-components'; import { Modal } from '@/components/base'; import { useToggle } from '@/hooks/common'; -function SuccessButton() { +interface SuccessButtonProps { + payName: string; +} + +function SuccessButton({ payName }: SuccessButtonProps) { const [isModal, onToggleModal] = useToggle(); const [isErrorModal, onToggleErrorModal] = useToggle(); @@ -23,8 +27,7 @@ function SuccessButton() { 복사 농협 301-0312-2534-81 - 받는 분 통장 표시는 카톡 아이디 첫 7자리로 해주세요!
- (ex: minsu30) + ⚠️ 받는 분 통장 표시를 ‘{payName}’ 로 바꿔주셔야 확인이 가능합니다 ⚠️
{isModal && ( { btnName={status} title={MatchingStateTitle(status)} handleStatus={handleStatus} - meeting={(matchingResult: MeetingPartnerSurvey) => ( + meeting={(matchingResult: MatchingResultResponse) => ( { { none: <>, waiting: , - success: , - femaleSuccess: , - pay: , - end: , + success: , + femaleSuccess: , + pay: , + end: , fail: , cancel: , }[status] } )} - dating={(matchingResult: DatingPartnerSurvey) => ( + dating={(matchingResult: MatchingResultResponse) => ( { { none: <>, waiting: , - success: , - femaleSuccess: , - pay: , - end: , + success: , + femaleSuccess: , + pay: , + end: , fail: , cancel: , }[status] From 1df9ff6367a5985857d07ebf3f9906bf6aa7c273 Mon Sep 17 00:00:00 2001 From: Jiyoung Kim Date: Tue, 2 Aug 2022 21:09:41 +0900 Subject: [PATCH 15/15] =?UTF-8?q?fix:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EC=A0=95=EA=B7=9C=EC=8B=9D=20=EC=9B=90=EB=9E=98=EB=8C=80?= =?UTF-8?q?=EB=A1=9C=20=EB=A1=A4=EB=B0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/authMail/EmailForm.tsx | 2 +- src/utils/validations.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/authMail/EmailForm.tsx b/src/components/authMail/EmailForm.tsx index 05abcfb..7e42566 100644 --- a/src/components/authMail/EmailForm.tsx +++ b/src/components/authMail/EmailForm.tsx @@ -33,7 +33,7 @@ const EmailForm = ({ onSubmitAuthCode }: EmailFormProps) => { newErrors.email = '이메일을 입력해주세요'; return newErrors; } - if (email && !checkForm({ value: email, type: 'email' })) newErrors.email = '교육용 이메일은 edu, ca, ie 중 하나로 끝나야 합니다.'; + if (email && !checkForm({ value: email, type: 'email' })) newErrors.email = '올바른 이메일이 아닙니다.'; return newErrors; }, }); diff --git a/src/utils/validations.ts b/src/utils/validations.ts index 78e6322..fd8bd40 100644 --- a/src/utils/validations.ts +++ b/src/utils/validations.ts @@ -7,7 +7,7 @@ interface checkFormProps { export const checkForm = ({ value, type }: checkFormProps) => { const regex = { - email: /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.(edu|ca|ie)$/i, + email: /^[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_.]?[0-9a-zA-Z])*.[a-zA-Z]{2,3}$/i, }; if (type === 'email') {