From b0c71f19f38d0711d3349e8de4fba4071df2fe2f Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Wed, 10 May 2023 20:08:20 +0900
Subject: [PATCH 01/52] =?UTF-8?q?refactor:=20progress=20bar=20component/co?=
=?UTF-8?q?mmon=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
---
.../common}/ProgressBar/ProgressBar.module.scss | 0
.../Signup/component => component/common}/ProgressBar/index.tsx | 0
src/page/Auth/Signup/index.tsx | 2 +-
3 files changed, 1 insertion(+), 1 deletion(-)
rename src/{page/Auth/Signup/component => component/common}/ProgressBar/ProgressBar.module.scss (100%)
rename src/{page/Auth/Signup/component => component/common}/ProgressBar/index.tsx (100%)
diff --git a/src/page/Auth/Signup/component/ProgressBar/ProgressBar.module.scss b/src/component/common/ProgressBar/ProgressBar.module.scss
similarity index 100%
rename from src/page/Auth/Signup/component/ProgressBar/ProgressBar.module.scss
rename to src/component/common/ProgressBar/ProgressBar.module.scss
diff --git a/src/page/Auth/Signup/component/ProgressBar/index.tsx b/src/component/common/ProgressBar/index.tsx
similarity index 100%
rename from src/page/Auth/Signup/component/ProgressBar/index.tsx
rename to src/component/common/ProgressBar/index.tsx
diff --git a/src/page/Auth/Signup/index.tsx b/src/page/Auth/Signup/index.tsx
index 4e5bf697..f9950c28 100644
--- a/src/page/Auth/Signup/index.tsx
+++ b/src/page/Auth/Signup/index.tsx
@@ -3,8 +3,8 @@ import useMediaQuery from 'utils/hooks/useMediaQuery';
import { ReactComponent as Logo } from 'assets/svg/auth/koin-logo.svg';
import { ReactComponent as Back } from 'assets/svg/common/back-arrow.svg';
import { Link } from 'react-router-dom';
+import ProgressBar from 'component/common/ProgressBar';
import UserEmail from './component/UserEmail';
-import ProgressBar from './component/ProgressBar';
import OwnerData from './view/OwnerDataPage';
import TermsOfService from './view/TermsOfServicePage';
import UserData from './view/UserDataPage';
From c83b6077401be285c885340bd7493021bc06e72c Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Tue, 16 May 2023 15:34:07 +0900
Subject: [PATCH 02/52] =?UTF-8?q?feat:=20=EC=95=BD=EA=B4=80=EB=8F=99?=
=?UTF-8?q?=EC=9D=98=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=95=BD=EA=B4=80?=
=?UTF-8?q?=EB=8F=99=EC=9D=98=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/constant/terms.ts | 4 +-
.../Signup/view/TermsOfServicePage/index.tsx | 69 ++++++++++++++-----
2 files changed, 55 insertions(+), 18 deletions(-)
diff --git a/src/page/Auth/Signup/constant/terms.ts b/src/page/Auth/Signup/constant/terms.ts
index 20558e7d..72f0d6a1 100644
--- a/src/page/Auth/Signup/constant/terms.ts
+++ b/src/page/Auth/Signup/constant/terms.ts
@@ -1,4 +1,4 @@
-const Terms = [
+const TEMRS = [
{
id: 'term_1',
title: '개인정보 이용약관',
@@ -19,4 +19,4 @@ const Terms = [
},
];
-export default Terms;
+export default TEMRS;
diff --git a/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx b/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx
index 157f7a0b..51fe59f5 100644
--- a/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx
+++ b/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx
@@ -1,48 +1,85 @@
import { Link } from 'react-router-dom';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import useMediaQuery from 'utils/hooks/useMediaQuery';
-import Terms from 'page/Auth/Signup/constant/terms';
+import TERMS from 'page/Auth/Signup/constant/terms';
+import { useEffect, useState } from 'react';
import styles from './TermsOfService.module.scss';
type ButtonClickEventProps = {
clickEvent: () => void;
};
+const useTermCheck = () => {
+ const [isUserTermAgree, setUserTermAgree] = useState(false);
+ const [isKoinTermAgree, setKoinTermAgree] = useState(false);
+ const [isAllAgree, setAllAgree] = useState(false);
+
+ const checkAll = () => {
+ if (isAllAgree) {
+ setUserTermAgree(false);
+ setKoinTermAgree(false);
+ } else {
+ setUserTermAgree(true);
+ setKoinTermAgree(true);
+ }
+ };
+ useEffect(() => {
+ setAllAgree(isKoinTermAgree && isUserTermAgree);
+ }, [isKoinTermAgree, isUserTermAgree]);
+ return {
+ isUserTermAgree, setUserTermAgree, isKoinTermAgree, setKoinTermAgree, isAllAgree, checkAll,
+ };
+};
+
export default function TermsOfService({ clickEvent }:ButtonClickEventProps) {
const { isMobile } = useMediaQuery();
+ const USER_TERM = TERMS[0];
+ const KOIN_TERM = TERMS[1];
+ const {
+ isUserTermAgree, setUserTermAgree, isKoinTermAgree, setKoinTermAgree, isAllAgree, checkAll,
+ } = useTermCheck();
return (
<>
- {Terms.map((term) => (
-
-
{term.title}
-
- {term.text}
-
-
+
+
{USER_TERM.title}
+
+ {USER_TERM.text}
+
+
+
+
+
{KOIN_TERM.title}
+
+ {KOIN_TERM.text}
- ))}
+
+
{isMobile ? (
<>
취소
- clickEvent()} />
+
>
)
- : clickEvent()} />}
+ : }
>
);
From dd9139796c1c2231ead7c51972fad5acc90976ca Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Mon, 5 Jun 2023 00:42:49 +0900
Subject: [PATCH 03/52] =?UTF-8?q?feat:=20=EB=B9=84=EB=B0=80=EB=B2=88?=
=?UTF-8?q?=ED=98=B8=20=EC=A4=91=EB=B3=B5=ED=99=95=EC=9D=B8=20=EB=A1=9C?=
=?UTF-8?q?=EC=A7=81=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../component/UserId/UserId.module.scss | 24 ++++++++++++--
.../Auth/Signup/component/UserId/index.tsx | 31 ++++++++++++++++---
2 files changed, 48 insertions(+), 7 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserId/UserId.module.scss b/src/page/Auth/Signup/component/UserId/UserId.module.scss
index 32ae4909..271e0cdf 100644
--- a/src/page/Auth/Signup/component/UserId/UserId.module.scss
+++ b/src/page/Auth/Signup/component/UserId/UserId.module.scss
@@ -11,7 +11,11 @@
margin-top: 8px;
margin-left: 8px;
color: #858585;
- font-size: 12px;
+ font-size: 11px;
+
+ @include media.media-breakpoint-down(mobile) {
+ margin: 0;
+ }
}
&__warn {
@@ -21,9 +25,15 @@
gap: 7px;
&--phrase {
+ margin-top: 8px;
+ margin-left: 8px;
display: block;
color: #f05d3d;
font-size: 11px;
+
+ @include media.media-breakpoint-down(mobile) {
+ margin: 0;
+ }
}
}
}
@@ -31,10 +41,20 @@
.input-block {
display: flex;
width: calc(100% - 2px);
- justify-content: space-between;
gap: 16px;
+ justify-content: space-between;
margin-top: 8px;
+ @include media.media-breakpoint-down(mobile) {
+ flex-direction: column;
+ gap: 0;
+ }
+
+ &__input-elements {
+ display: flex;
+ align-items: end;
+ }
+
&__input {
width: calc(100% - 32px - 80px);
border: 1px solid #d2dae2;
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 43f569c2..7bdde40b 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -1,10 +1,12 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
+import { useState } from 'react';
import styles from './UserId.module.scss';
export default function UserId() {
const { isMobile } = useMediaQuery();
+ const [isUsable, setUsable] = useState
(null);
return (
!isMobile
? (
@@ -12,17 +14,36 @@ export default function UserId() {
아이디
-
+ { setUsable(true); }} />
- 사용하실 수 있는 아이디 입니다.
+ { isUsable !== null
+ && (
+ <>
+ {isUsable && 사용하실 수 있는 아이디 입니다.}
+ {!isUsable && 이미 가입된 이메일입니다.}
+ >
+ )}
)
: (
)
From ee9ef0b53bece7bde06481c18c72117d7e924ae0 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Mon, 5 Jun 2023 01:09:44 +0900
Subject: [PATCH 04/52] =?UTF-8?q?feat:=20=EB=B9=84=EB=B0=80=EB=B2=88?=
=?UTF-8?q?=ED=98=B8=20=EB=B3=B4=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20=EB=A1=9C?=
=?UTF-8?q?=EC=A7=81=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Signup/component/UserPassword/index.tsx | 25 ++++++++++++++++---
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserPassword/index.tsx b/src/page/Auth/Signup/component/UserPassword/index.tsx
index 21ada988..7be8c9ad 100644
--- a/src/page/Auth/Signup/component/UserPassword/index.tsx
+++ b/src/page/Auth/Signup/component/UserPassword/index.tsx
@@ -1,26 +1,43 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
import { ReactComponent as VisibleImage } from 'assets/svg/auth/visible.svg';
import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
+import { useRef } from 'react';
import styles from './UserPassword.module.scss';
+const useVisible = () => {
+ const visibility = useRef(null);
+ const setVisible = () => {
+ if (visibility.current) {
+ if (visibility.current.type === 'password') {
+ visibility.current.type = 'text';
+ } else {
+ visibility.current.type = 'password';
+ }
+ }
+ };
+ return { visibility, setVisible };
+};
+
export default function UserPassword() {
const { isMobile } = useMediaQuery();
+ const { visibility: passwordVisibility, setVisible: setPasswordVisibility } = useVisible();
+ const { visibility: checkVisibility, setVisible: setCheckVisibility } = useVisible();
return (
{!isMobile &&
비밀번호}
-
+
{!isMobile && (
-
-
+
{!isMobile && (
-
+
)}
From 5cd98dd940b67aa652badb1745da91b6b2a268f1 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Mon, 5 Jun 2023 22:45:02 +0900
Subject: [PATCH 05/52] =?UTF-8?q?feat:=20=EC=BB=A4=EC=8A=A4=ED=85=80=20?=
=?UTF-8?q?=EB=B2=84=ED=8A=BC=20=EC=82=AC=EC=9D=B4=EC=A6=88,=20submit/butt?=
=?UTF-8?q?on=20=ED=83=80=EC=9E=85=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/component/CustomButton/index.tsx | 9 +++++----
src/page/Auth/Signup/component/UserEmail/index.tsx | 6 +++---
src/page/Auth/Signup/view/OwnerDataPage/index.tsx | 2 +-
src/page/Auth/Signup/view/TermsOfServicePage/index.tsx | 4 ++--
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/page/Auth/Signup/component/CustomButton/index.tsx b/src/page/Auth/Signup/component/CustomButton/index.tsx
index d770009b..cd213619 100644
--- a/src/page/Auth/Signup/component/CustomButton/index.tsx
+++ b/src/page/Auth/Signup/component/CustomButton/index.tsx
@@ -2,18 +2,19 @@ import styles from './CustomButton.module.scss';
interface ButtonProps {
content:string,
- buttonType:string,
+ buttonSize:string,
disable?: boolean,
+ submit?:boolean
onClick?: () => void
}
export default function CustomButton({
- content, buttonType, disable, onClick,
+ content, buttonSize, disable, onClick, submit,
}:ButtonProps) {
return (
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index f5aae42e..ecf52b63 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -17,7 +17,7 @@ export default function UserEmail({ clickEvent }:ButtonClickEvent) {
* 제한시간 5 : 00
-
+
)
: (
@@ -35,8 +35,8 @@ export default function UserEmail({ clickEvent }:ButtonClickEvent) {
* 제한시간 5 : 00
- { alert('재발송'); }} />
-
+ { alert('재발송'); }} />
+
>
)
diff --git a/src/page/Auth/Signup/view/OwnerDataPage/index.tsx b/src/page/Auth/Signup/view/OwnerDataPage/index.tsx
index 8e45ea1a..8c21e041 100644
--- a/src/page/Auth/Signup/view/OwnerDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/OwnerDataPage/index.tsx
@@ -52,7 +52,7 @@ export default function OwnerData({ clickEvent }:ButtonClickEvent) {
-
+
>
);
diff --git a/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx b/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx
index 51fe59f5..9426d2a6 100644
--- a/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx
+++ b/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx
@@ -76,10 +76,10 @@ export default function TermsOfService({ clickEvent }:ButtonClickEventProps) {
{isMobile ? (
<>
취소
-
+
>
)
- : }
+ : }
>
);
From 6b2a57d0e2ee55551eb4e81cece3e80eb9e59f76 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Mon, 5 Jun 2023 22:45:48 +0900
Subject: [PATCH 06/52] =?UTF-8?q?feat:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?=
=?UTF-8?q?=EC=9E=85=EB=A0=A5=20=ED=8F=BC=20=EB=A1=9C=EC=A7=81=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 1 +
.../Auth/Signup/component/UserId/index.tsx | 60 ++++++++++++++++---
yarn.lock | 5 ++
3 files changed, 58 insertions(+), 8 deletions(-)
diff --git a/package.json b/package.json
index 36f4ac69..0c77396b 100644
--- a/package.json
+++ b/package.json
@@ -50,6 +50,7 @@
]
},
"devDependencies": {
+ "@types/react": "^18.2.8",
"@typescript-eslint/eslint-plugin": "^5.30.0",
"@typescript-eslint/parser": "^5.30.0",
"eslint": "^8.18.0",
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 7bdde40b..22208c29 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -2,20 +2,57 @@ import useMediaQuery from 'utils/hooks/useMediaQuery';
import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { useState } from 'react';
+// eslint-disable-next-line import/no-extraneous-dependencies
+import { SubmitHandler, useForm } from 'react-hook-form';
import styles from './UserId.module.scss';
+const REG_EX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
+type FormData = {
+ email:string
+};
+
+const useEmailDuplicateCheck = () => {
+ const {
+ register: emailRegister,
+ handleSubmit: emailHandleSubmit,
+ formState: { errors },
+ } = useForm();
+ const emailDuplicateRegister = emailRegister('email', {
+ required: { value: true, message: '이메일을 입력해주세요.' },
+ pattern: {
+ value: REG_EX,
+ message: '유효한 이메일 주소를 입력해주세요.',
+ },
+ });
+ return {
+ emailHandleSubmit, errors, emailDuplicateRegister,
+ };
+};
+
export default function UserId() {
const { isMobile } = useMediaQuery();
const [isUsable, setUsable] = useState(null);
+ const { emailHandleSubmit, errors, emailDuplicateRegister } = useEmailDuplicateCheck();
+ const onSubmit:SubmitHandler = (data) => {
+ console.log('이메일 중복 체크', data);
+ setUsable(!isUsable);
+ };
return (
!isMobile
? (
-
+
)
: (
-
+
)
);
}
diff --git a/yarn.lock b/yarn.lock
index e0651f93..120c69a7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7808,6 +7808,11 @@ react-error-overlay@^6.0.11:
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb"
integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg==
+react-hook-form@^7.44.3:
+ version "7.44.3"
+ resolved "https://registry.yarnpkg.com/react-hook-form/-/react-hook-form-7.44.3.tgz#a99e560c6ef2b668db1daaebc4f98267331b6828"
+ integrity sha512-/tHId6p2ViAka1wECMw8FEPn/oz/w226zehHrJyQ1oIzCBNMIJCaj6ZkQcv+MjDxYh9MWR7RQic7Qqwe4a5nkw==
+
react-is@^16.13.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
From ba16115b44dd8855c3fcbf5537773d634300b52d Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Tue, 6 Jun 2023 16:44:59 +0900
Subject: [PATCH 07/52] =?UTF-8?q?style:=20id=EC=9D=B8=ED=92=8B=20=EC=8A=A4?=
=?UTF-8?q?=ED=83=80=EC=9D=BC=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Auth/Signup/component/UserId/index.tsx | 29 ++++---------------
.../Auth/Signup/hooks/useEmailDataCheck.tsx | 26 +++++++++++++++++
2 files changed, 31 insertions(+), 24 deletions(-)
create mode 100644 src/page/Auth/Signup/hooks/useEmailDataCheck.tsx
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 22208c29..ad50f0bb 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -3,37 +3,18 @@ import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { useState } from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
-import { SubmitHandler, useForm } from 'react-hook-form';
+import { SubmitHandler } from 'react-hook-form';
+import useEmailDuplicateCheck from 'page/Auth/Signup/hooks/useEmailDataCheck';
import styles from './UserId.module.scss';
-const REG_EX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
-type FormData = {
+type EmailForm = {
email:string
};
-
-const useEmailDuplicateCheck = () => {
- const {
- register: emailRegister,
- handleSubmit: emailHandleSubmit,
- formState: { errors },
- } = useForm();
- const emailDuplicateRegister = emailRegister('email', {
- required: { value: true, message: '이메일을 입력해주세요.' },
- pattern: {
- value: REG_EX,
- message: '유효한 이메일 주소를 입력해주세요.',
- },
- });
- return {
- emailHandleSubmit, errors, emailDuplicateRegister,
- };
-};
-
export default function UserId() {
const { isMobile } = useMediaQuery();
const [isUsable, setUsable] = useState(null);
const { emailHandleSubmit, errors, emailDuplicateRegister } = useEmailDuplicateCheck();
- const onSubmit:SubmitHandler = (data) => {
+ const onSubmit:SubmitHandler = (data) => {
console.log('이메일 중복 체크', data);
setUsable(!isUsable);
};
@@ -66,7 +47,7 @@ export default function UserId() {
);
}
From 51274d99e45b65de37c5e660efabdc7903bf8da9 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Mon, 26 Jun 2023 15:35:28 +0900
Subject: [PATCH 15/52] =?UTF-8?q?feat:=20=EC=9C=A0=EC=A0=80=20id=20?=
=?UTF-8?q?=EC=9E=85=EB=A0=A5=20=EC=9D=B8=ED=92=8B=20type=20=EC=A7=80?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../component/UserEmail/UserEmail.module.scss | 5 +++++
src/page/Auth/Signup/component/UserId/index.tsx | 13 ++++++++++---
.../{useEmailDataCheck.tsx => useEmailDataCheck.ts} | 1 +
src/page/Auth/Signup/types/UserData.ts | 5 +++++
src/page/Auth/Signup/view/UserDataPage/index.tsx | 12 ++++++++++--
5 files changed, 31 insertions(+), 5 deletions(-)
rename src/page/Auth/Signup/hooks/{useEmailDataCheck.tsx => useEmailDataCheck.ts} (91%)
create mode 100644 src/page/Auth/Signup/types/UserData.ts
diff --git a/src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss b/src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss
index 08590f05..49707770 100644
--- a/src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss
+++ b/src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss
@@ -20,6 +20,11 @@
height: calc(48px - 30px);
padding: 14px 16px;
+ &::-webkit-inner-spin-button {
+ appearance: none;
+ margin: 0;
+ }
+
@include media.media-breakpoint-down(mobile) {
width: 100%;
margin-top: 31px;
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 7e448cda..8ddb9bfd 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -1,22 +1,29 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
-import { useState } from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import { SubmitHandler } from 'react-hook-form';
import useEmailDuplicateCheck from 'page/Auth/Signup/hooks/useEmailDataCheck';
+import { useState } from 'react';
+import { RegisterData } from 'page/Auth/Signup/types/UserData';
import styles from './UserId.module.scss';
type EmailForm = {
email:string
};
-export default function UserId() {
+interface EmailInputProps {
+ setId: (data:RegisterData) => void,
+ userData?: RegisterData
+}
+
+export default function UserId({ setId, userData }:EmailInputProps) {
const { isMobile } = useMediaQuery();
const [isUsable, setUsable] = useState(null);
const { emailHandleSubmit, errors, emailDuplicateRegister } = useEmailDuplicateCheck();
const onSubmit:SubmitHandler = (data) => {
- console.log('이메일 중복 체크', data);
+ console.log('이메일 중복 체크', data.email);
+ setId({ ...userData, email: data.email });
setUsable(!isUsable);
};
return (
diff --git a/src/page/Auth/Signup/hooks/useEmailDataCheck.tsx b/src/page/Auth/Signup/hooks/useEmailDataCheck.ts
similarity index 91%
rename from src/page/Auth/Signup/hooks/useEmailDataCheck.tsx
rename to src/page/Auth/Signup/hooks/useEmailDataCheck.ts
index e4b9ce57..e5f2c2a9 100644
--- a/src/page/Auth/Signup/hooks/useEmailDataCheck.tsx
+++ b/src/page/Auth/Signup/hooks/useEmailDataCheck.ts
@@ -1,3 +1,4 @@
+// eslint-disable-next-line import/no-extraneous-dependencies
import { useForm } from 'react-hook-form';
const REG_EX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
diff --git a/src/page/Auth/Signup/types/UserData.ts b/src/page/Auth/Signup/types/UserData.ts
new file mode 100644
index 00000000..db08d368
--- /dev/null
+++ b/src/page/Auth/Signup/types/UserData.ts
@@ -0,0 +1,5 @@
+export type RegisterData = {
+ email?: string,
+ password?: string,
+ isAuthentication?: boolean
+};
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 676e4306..136b851e 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -3,6 +3,8 @@ import UserId from 'page/Auth/Signup/component/UserId';
import UserPassword from 'page/Auth/Signup/component/UserPassword';
import useMediaQuery from 'utils/hooks/useMediaQuery';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
+import { useEffect, useState } from 'react';
+import { RegisterData } from 'page/Auth/Signup/types/UserData';
import styles from './UserData.module.scss';
type ButtonClickEventProps = {
@@ -10,15 +12,21 @@ type ButtonClickEventProps = {
};
export default function UserData({ clickEvent }:ButtonClickEventProps) {
const { isMobile } = useMediaQuery();
+ const [isDone, setDone] = useState(false);
+ console.log(setDone);
+ const [userData, setData] = useState();
+ useEffect(() => {
+ console.log(userData, setDone, 'asdf');
+ }, [userData]);
return (
<>
- clickEvent()} />
+ clickEvent()} disable={!isDone} />
>
);
From 4f626646e4e464c868c3ddd1d05baf656c407bd9 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Mon, 26 Jun 2023 16:43:36 +0900
Subject: [PATCH 16/52] =?UTF-8?q?feat:=20=EC=9C=A0=EC=A0=80=20=ED=9A=8C?=
=?UTF-8?q?=EC=9B=90=EA=B0=80=EC=9E=85=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20?=
=?UTF-8?q?=EB=B9=84=EB=B0=80=EB=B2=88=ED=98=B8=20=EA=B0=92=20=ED=83=80?=
=?UTF-8?q?=EC=9E=85=20=EC=A7=80=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Auth/Signup/component/UserId/index.tsx | 8 ++-----
.../Signup/component/UserPassword/index.tsx | 23 +++++++++++++++----
.../Auth/Signup/hooks/useEmailDataCheck.ts | 7 ++----
.../Auth/Signup/hooks/usePasswordConfirm.ts | 8 ++++++-
.../types/{UserData.ts => RegisterData.ts} | 0
.../Auth/Signup/view/UserDataPage/index.tsx | 4 ++--
6 files changed, 31 insertions(+), 19 deletions(-)
rename src/page/Auth/Signup/types/{UserData.ts => RegisterData.ts} (100%)
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 8ddb9bfd..2e8d03da 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -5,13 +5,9 @@ import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { SubmitHandler } from 'react-hook-form';
import useEmailDuplicateCheck from 'page/Auth/Signup/hooks/useEmailDataCheck';
import { useState } from 'react';
-import { RegisterData } from 'page/Auth/Signup/types/UserData';
+import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import styles from './UserId.module.scss';
-type EmailForm = {
- email:string
-};
-
interface EmailInputProps {
setId: (data:RegisterData) => void,
userData?: RegisterData
@@ -21,7 +17,7 @@ export default function UserId({ setId, userData }:EmailInputProps) {
const { isMobile } = useMediaQuery();
const [isUsable, setUsable] = useState(null);
const { emailHandleSubmit, errors, emailDuplicateRegister } = useEmailDuplicateCheck();
- const onSubmit:SubmitHandler = (data) => {
+ const onSubmit:SubmitHandler = (data) => {
console.log('이메일 중복 체크', data.email);
setId({ ...userData, email: data.email });
setUsable(!isUsable);
diff --git a/src/page/Auth/Signup/component/UserPassword/index.tsx b/src/page/Auth/Signup/component/UserPassword/index.tsx
index 99db4c64..f09a0e4d 100644
--- a/src/page/Auth/Signup/component/UserPassword/index.tsx
+++ b/src/page/Auth/Signup/component/UserPassword/index.tsx
@@ -4,14 +4,28 @@ import { ReactComponent as BlindIcon } from 'assets/svg/auth/blind.svg';
import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import useBooleanState from 'utils/hooks/useBooleanState';
import usePasswordConfirm from 'page/Auth/Signup/hooks/usePasswordConfirm';
+import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
+// eslint-disable-next-line import/no-extraneous-dependencies
+import { SubmitHandler } from 'react-hook-form';
import styles from './UserPassword.module.scss';
-export default function UserPassword() {
+interface PasswordInputProps {
+ setPassword: (data:RegisterData) => void,
+ userData?: RegisterData
+}
+
+export default function UserPassword({ setPassword, userData }:PasswordInputProps) {
const { isMobile } = useMediaQuery();
const { value: isBlind, changeValue: changeIsBlind } = useBooleanState(true);
- const { passwordRegister, passwordConfirmRegister, errors } = usePasswordConfirm();
+ const {
+ passwordRegister, passwordConfirmRegister, errors, handleSubmit,
+ } = usePasswordConfirm();
+ const onSubmit:SubmitHandler = (data) => {
+ console.log(data, userData, setPassword);
+ setPassword({ ...userData, password: data.password });
+ };
return (
-
+
);
}
diff --git a/src/page/Auth/Signup/hooks/useEmailDataCheck.ts b/src/page/Auth/Signup/hooks/useEmailDataCheck.ts
index e5f2c2a9..4bdde833 100644
--- a/src/page/Auth/Signup/hooks/useEmailDataCheck.ts
+++ b/src/page/Auth/Signup/hooks/useEmailDataCheck.ts
@@ -1,18 +1,15 @@
// eslint-disable-next-line import/no-extraneous-dependencies
import { useForm } from 'react-hook-form';
+import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
const REG_EX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
-type EmailForm = {
- email:string
-};
-
export default function useEmailDuplicateCheck() {
const {
register: emailRegister,
handleSubmit: emailHandleSubmit,
formState: { errors },
- } = useForm();
+ } = useForm();
const emailDuplicateRegister = emailRegister('email', {
required: { value: true, message: '이메일을 입력해주세요.' },
pattern: {
diff --git a/src/page/Auth/Signup/hooks/usePasswordConfirm.ts b/src/page/Auth/Signup/hooks/usePasswordConfirm.ts
index 96d5c7e5..94f59b8e 100644
--- a/src/page/Auth/Signup/hooks/usePasswordConfirm.ts
+++ b/src/page/Auth/Signup/hooks/usePasswordConfirm.ts
@@ -1,3 +1,4 @@
+// eslint-disable-next-line import/no-extraneous-dependencies
import { useForm } from 'react-hook-form';
const REG_EX = /^(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,18}$/i;
@@ -12,6 +13,7 @@ export default function usePasswordConfirm() {
register,
formState: { errors },
getValues,
+ handleSubmit,
} = useForm({ mode: 'onBlur' });
const passwordRegister = register('password', {
@@ -24,9 +26,13 @@ export default function usePasswordConfirm() {
const passwordConfirmRegister = register('passwordConfirm', {
required: { value: true, message: '비밀번호 확인을 입력해주세요.' },
+ pattern: {
+ value: REG_EX,
+ message: '특수문자 포함 영어와 숫자 조합 6~18 자리를 입력해주세요',
+ },
validate: (password) => password === getValues('password') || '비밀번호가 일치하지 않습니다',
});
return {
- passwordRegister, errors, passwordConfirmRegister,
+ passwordRegister, errors, passwordConfirmRegister, handleSubmit,
};
}
diff --git a/src/page/Auth/Signup/types/UserData.ts b/src/page/Auth/Signup/types/RegisterData.ts
similarity index 100%
rename from src/page/Auth/Signup/types/UserData.ts
rename to src/page/Auth/Signup/types/RegisterData.ts
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 136b851e..4ac6321e 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -4,7 +4,7 @@ import UserPassword from 'page/Auth/Signup/component/UserPassword';
import useMediaQuery from 'utils/hooks/useMediaQuery';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { useEffect, useState } from 'react';
-import { RegisterData } from 'page/Auth/Signup/types/UserData';
+import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import styles from './UserData.module.scss';
type ButtonClickEventProps = {
@@ -22,7 +22,7 @@ export default function UserData({ clickEvent }:ButtonClickEventProps) {
<>
From 198a82cceabaf291d6410f8c15ea094ada2aca3e Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Sat, 1 Jul 2023 13:56:12 +0900
Subject: [PATCH 17/52] =?UTF-8?q?feat:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?=
=?UTF-8?q?=EC=9D=B8=EC=A6=9D=20=EB=A1=9C=EC=A7=81=20=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../component/UserEmail/UserEmail.module.scss | 16 +++++
.../Auth/Signup/component/UserEmail/index.tsx | 64 +++++++++++++++----
src/page/Auth/Signup/hooks/useAuthCheck.ts | 14 ++++
src/page/Auth/Signup/hooks/useEmailAuth.ts | 18 ++++++
.../Auth/Signup/view/UserDataPage/index.tsx | 2 +-
5 files changed, 101 insertions(+), 13 deletions(-)
create mode 100644 src/page/Auth/Signup/hooks/useAuthCheck.ts
create mode 100644 src/page/Auth/Signup/hooks/useEmailAuth.ts
diff --git a/src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss b/src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss
index 49707770..2b2c9e5e 100644
--- a/src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss
+++ b/src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss
@@ -6,11 +6,27 @@
font-size: 18px;
}
+ &__warn {
+ display: flex;
+ align-items: center;
+ margin-top: 9px;
+ margin-bottom: 16px;
+ gap: 7px;
+ height: 11px;
+
+ &--phrase {
+ display: block;
+ color: #f05d3d;
+ font-size: 11px;
+ }
+ }
+
&__input {
width: calc(100% - 2px);
display: flex;
flex-direction: column;
margin-top: 8px;
+ margin-bottom: 16px;
gap: 8px;
}
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index 5415af37..fb2d2149 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -1,30 +1,70 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
+import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { useState } from 'react';
+// eslint-disable-next-line import/no-extraneous-dependencies
+import { SubmitHandler } from 'react-hook-form';
+import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
+import useEmailDuplicateCheck from 'page/Auth/Signup/hooks/useEmailDataCheck';
+import useAuthCheck from 'page/Auth/Signup/hooks/useAuthCheck';
import styles from './UserEmail.module.scss';
type ButtonClickEvent = {
- clickEvent?: () => void | null
+ clickEvent?: () => void | null,
+ userData?: RegisterData,
+ setAuthenticate?: (data:RegisterData) => void
};
-export default function UserEmail({ clickEvent }:ButtonClickEvent) {
+export default function UserEmail({ clickEvent, userData, setAuthenticate }:ButtonClickEvent) {
const { isMobile } = useMediaQuery();
const [isOpen, setOpen] = useState(false);
+ const { emailHandleSubmit, errors, emailDuplicateRegister } = useEmailDuplicateCheck();
+ const { authInput, checkAuthNumber } = useAuthCheck();
+ const onSubmit:SubmitHandler
= (data) => {
+ setOpen(true);
+ console.log(data.email, setOpen);
+ };
+ const compareAuthNumber = () => {
+ // 인증 번호 입력
+ if (checkAuthNumber('123456')) {
+ if (setAuthenticate) {
+ setAuthenticate({ ...userData, isAuthentication: true });
+ }
+ } else {
+ alert('not match');
+ }
+ };
return (
!isMobile
? (
-
+ {errors.email && (
+
+
+ {errors.email.message}
+
+ )}
+ {isOpen ? (
+ <>
+ * 제한시간 5 : 00
+
+ >
+ ) : (
+
+ )}
+
)
: (
<>
diff --git a/src/page/Auth/Signup/hooks/useAuthCheck.ts b/src/page/Auth/Signup/hooks/useAuthCheck.ts
new file mode 100644
index 00000000..e98d8b63
--- /dev/null
+++ b/src/page/Auth/Signup/hooks/useAuthCheck.ts
@@ -0,0 +1,14 @@
+import { useRef } from 'react';
+
+export default function useAuthCheck() {
+ const authInput = useRef(null);
+
+ const checkAuthNumber = (authNumber:string) => {
+ if (authInput.current?.value === authNumber) {
+ return true;
+ }
+ return false;
+ };
+
+ return { authInput, checkAuthNumber };
+}
diff --git a/src/page/Auth/Signup/hooks/useEmailAuth.ts b/src/page/Auth/Signup/hooks/useEmailAuth.ts
new file mode 100644
index 00000000..449ae01e
--- /dev/null
+++ b/src/page/Auth/Signup/hooks/useEmailAuth.ts
@@ -0,0 +1,18 @@
+// eslint-disable-next-line import/no-extraneous-dependencies
+import { useForm } from 'react-hook-form';
+
+const REG_EX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
+
+export default function useEamilAuth() {
+ const { register, handleSubmit, formState: { errors } } = useForm();
+
+ const emailAuthRegister = register('emailAuth', {
+ required: { value: true, message: '이메일을 입력해주세요.' },
+ pattern: {
+ value: REG_EX,
+ message: '유효한 이메일 주소를 입력해주세요.',
+ },
+ });
+
+ return { emailAuthRegister, handleSubmit, errors };
+}
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 4ac6321e..b0e59179 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -23,7 +23,7 @@ export default function UserData({ clickEvent }:ButtonClickEventProps) {
- {!isMobile && }
+ {!isMobile && }
clickEvent()} disable={!isDone} />
From 9135ca1c33c33f18eb0ed9d3948b51c26a951faa Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Sat, 1 Jul 2023 15:10:41 +0900
Subject: [PATCH 18/52] =?UTF-8?q?feat:=20=EB=8B=A4=EC=9D=8C=20=EB=B2=84?=
=?UTF-8?q?=ED=8A=BC=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Auth/Signup/component/UserEmail/index.tsx | 2 +-
src/page/Auth/Signup/hooks/useCheckNext.ts | 21 +++++++++++++++++++
.../Auth/Signup/view/UserDataPage/index.tsx | 13 +++++++-----
3 files changed, 30 insertions(+), 6 deletions(-)
create mode 100644 src/page/Auth/Signup/hooks/useCheckNext.ts
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index fb2d2149..52706ce9 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -21,7 +21,7 @@ export default function UserEmail({ clickEvent, userData, setAuthenticate }:Butt
const { authInput, checkAuthNumber } = useAuthCheck();
const onSubmit:SubmitHandler = (data) => {
setOpen(true);
- console.log(data.email, setOpen);
+ console.log(data.email);
};
const compareAuthNumber = () => {
// 인증 번호 입력
diff --git a/src/page/Auth/Signup/hooks/useCheckNext.ts b/src/page/Auth/Signup/hooks/useCheckNext.ts
new file mode 100644
index 00000000..1d4da1fb
--- /dev/null
+++ b/src/page/Auth/Signup/hooks/useCheckNext.ts
@@ -0,0 +1,21 @@
+import { useState } from 'react';
+import { z } from 'zod';
+import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
+
+export default function useCheckNext() {
+ const [isDone, setDone] = useState(false);
+
+ const User = z.object({
+ email: z.string(),
+ password: z.string(),
+ isAuthentication: z.boolean(),
+ });
+
+ const checkNext = (userData:RegisterData) => {
+ if (User.safeParse(userData).success) {
+ setDone(true);
+ }
+ };
+
+ return { isDone, checkNext };
+}
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index b0e59179..5d4b76ad 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -5,19 +5,22 @@ import useMediaQuery from 'utils/hooks/useMediaQuery';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { useEffect, useState } from 'react';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
+import useCheckNext from 'page/Auth/Signup/hooks/useCheckNext';
import styles from './UserData.module.scss';
type ButtonClickEventProps = {
clickEvent: () => void;
};
+
export default function UserData({ clickEvent }:ButtonClickEventProps) {
const { isMobile } = useMediaQuery();
- const [isDone, setDone] = useState(false);
- console.log(setDone);
- const [userData, setData] = useState();
+ const [userData, setData] = useState({});
+ const { isDone, checkNext } = useCheckNext();
+
useEffect(() => {
- console.log(userData, setDone, 'asdf');
- }, [userData]);
+ checkNext(userData);
+ }, [userData, checkNext]);
+
return (
<>
From df8e2768bf6189bbddaa3e0bc7a9114c8f7bf760 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Sat, 1 Jul 2023 15:57:59 +0900
Subject: [PATCH 19/52] =?UTF-8?q?feat:=20zod=20=ED=9A=8C=EC=9B=90=EA=B0=80?=
=?UTF-8?q?=EC=9E=85=EC=9A=A9=20=EC=8A=A4=ED=82=A4=EB=A7=88=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/auth/model.ts | 8 ++++++++
src/page/Auth/Signup/hooks/useCheckNext.ts | 16 +++++-----------
src/page/Auth/Signup/view/UserDataPage/index.tsx | 6 +++---
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/api/auth/model.ts b/src/api/auth/model.ts
index 4ec802a6..179d4f30 100644
--- a/src/api/auth/model.ts
+++ b/src/api/auth/model.ts
@@ -36,3 +36,11 @@ export const UserResponse = z.object({
});
export type UserResponse = z.infer;
+
+export const RegisterParam = z.object({
+ email: z.string(),
+ password: z.string(),
+ isAuthentication: z.boolean(),
+});
+
+export type RegisterParam = z.infer;
diff --git a/src/page/Auth/Signup/hooks/useCheckNext.ts b/src/page/Auth/Signup/hooks/useCheckNext.ts
index 1d4da1fb..41eb6f9e 100644
--- a/src/page/Auth/Signup/hooks/useCheckNext.ts
+++ b/src/page/Auth/Signup/hooks/useCheckNext.ts
@@ -1,21 +1,15 @@
import { useState } from 'react';
-import { z } from 'zod';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
+import { RegisterParam } from 'api/auth/model';
-export default function useCheckNext() {
+export default function useCheckNextStep() {
const [isDone, setDone] = useState(false);
- const User = z.object({
- email: z.string(),
- password: z.string(),
- isAuthentication: z.boolean(),
- });
-
- const checkNext = (userData:RegisterData) => {
- if (User.safeParse(userData).success) {
+ const checkNextStep = (userData:RegisterData) => {
+ if (RegisterParam.safeParse(userData).success) {
setDone(true);
}
};
- return { isDone, checkNext };
+ return { isDone, checkNextStep };
}
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 5d4b76ad..e100789d 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -15,11 +15,11 @@ type ButtonClickEventProps = {
export default function UserData({ clickEvent }:ButtonClickEventProps) {
const { isMobile } = useMediaQuery();
const [userData, setData] = useState({});
- const { isDone, checkNext } = useCheckNext();
+ const { isDone, checkNextStep } = useCheckNext();
useEffect(() => {
- checkNext(userData);
- }, [userData, checkNext]);
+ checkNextStep(userData);
+ }, [userData, checkNextStep]);
return (
<>
From 3cf46d3e7b42134b194fcaba6c5fc25ad9fea6a1 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Wed, 5 Jul 2023 16:29:12 +0900
Subject: [PATCH 20/52] =?UTF-8?q?feat:=20=EB=AA=A8=EB=B0=94=EC=9D=BC?=
=?UTF-8?q?=EC=9A=A9=20id=EC=9E=85=EB=A0=A5=20=EC=9D=B8=ED=92=8B=20?=
=?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/component/UserId/index.tsx | 13 ++++++++++++-
src/page/Auth/Signup/index.tsx | 2 +-
src/page/Auth/Signup/view/UserDataPage/index.tsx | 1 +
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 2e8d03da..f4cb9bc0 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -22,8 +22,19 @@ export default function UserId({ setId, userData }:EmailInputProps) {
setId({ ...userData, email: data.email });
setUsable(!isUsable);
};
+ const mobileSubmit:SubmitHandler = (data) => {
+ if (isMobile) {
+ console.log('이메일 중복 체크', data.email);
+ setId({ ...userData, email: data.email });
+ setUsable(!isUsable);
+ }
+ };
return (
-
{errors.email && (
From 50dbd2d57d95f693fa94bc8d445df860e5924a10 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Fri, 7 Jul 2023 18:36:08 +0900
Subject: [PATCH 24/52] =?UTF-8?q?feat:=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20?=
=?UTF-8?q?=EB=B7=B0=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EC=9D=B8=EC=A6=9D?=
=?UTF-8?q?=EB=B2=88=ED=98=B8=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/auth/model.ts | 5 +++-
.../Auth/Signup/component/UserEmail/index.tsx | 26 +++++++++++-------
.../{useCheckNext.ts => useCheckNextStep.ts} | 1 +
.../Auth/Signup/view/UserDataPage/index.tsx | 27 +++++++++++++++----
4 files changed, 43 insertions(+), 16 deletions(-)
rename src/page/Auth/Signup/hooks/{useCheckNext.ts => useCheckNextStep.ts} (93%)
diff --git a/src/api/auth/model.ts b/src/api/auth/model.ts
index 2434834b..b2223f75 100644
--- a/src/api/auth/model.ts
+++ b/src/api/auth/model.ts
@@ -56,7 +56,10 @@ export type UserResponse = z.infer
;
export const RegisterParam = z.object({
email: z.string(),
password: z.string(),
- isAuthentication: z.boolean(),
+ isAuthentication: z.boolean().refine((value) => value === true, {
+ message: 'isAuth는 true여야 합니다.',
+ path: ['isAuth'],
+ }),
});
export type RegisterParam = z.infer;
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index 52706ce9..93526f87 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -11,8 +11,8 @@ import styles from './UserEmail.module.scss';
type ButtonClickEvent = {
clickEvent?: () => void | null,
- userData?: RegisterData,
- setAuthenticate?: (data:RegisterData) => void
+ userData: RegisterData,
+ setAuthenticate: (data:RegisterData) => void
};
export default function UserEmail({ clickEvent, userData, setAuthenticate }:ButtonClickEvent) {
const { isMobile } = useMediaQuery();
@@ -24,13 +24,13 @@ export default function UserEmail({ clickEvent, userData, setAuthenticate }:Butt
console.log(data.email);
};
const compareAuthNumber = () => {
- // 인증 번호 입력
- if (checkAuthNumber('123456')) {
- if (setAuthenticate) {
+ if (authInput.current?.value.length === 6) {
+ // 인증 번호 입력
+ if (checkAuthNumber('123456')) {
setAuthenticate({ ...userData, isAuthentication: true });
+ } else {
+ setAuthenticate({ ...userData, isAuthentication: false });
}
- } else {
- alert('not match');
}
};
return (
@@ -40,7 +40,7 @@ export default function UserEmail({ clickEvent, userData, setAuthenticate }:Butt
이메일 인증
- {isOpen && }
+ {isOpen && }
{errors.email && (
@@ -70,14 +70,20 @@ export default function UserEmail({ clickEvent, userData, setAuthenticate }:Butt
<>
diff --git a/src/page/Auth/Signup/hooks/useCheckNext.ts b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
similarity index 93%
rename from src/page/Auth/Signup/hooks/useCheckNext.ts
rename to src/page/Auth/Signup/hooks/useCheckNextStep.ts
index 41eb6f9e..123d5508 100644
--- a/src/page/Auth/Signup/hooks/useCheckNext.ts
+++ b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
@@ -6,6 +6,7 @@ export default function useCheckNextStep() {
const [isDone, setDone] = useState(false);
const checkNextStep = (userData:RegisterData) => {
+ console.log(userData);
if (RegisterParam.safeParse(userData).success) {
setDone(true);
}
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 44ec3fd4..087cbc8c 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -5,28 +5,45 @@ import useMediaQuery from 'utils/hooks/useMediaQuery';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { useEffect, useState } from 'react';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
-import useCheckNext from 'page/Auth/Signup/hooks/useCheckNext';
import useStepStore from 'store/useStepStore';
+// eslint-disable-next-line import/no-named-as-default
+import useCheckNextStep from 'page/Auth/Signup/hooks/useCheckNextStep';
+import { RegisterParam } from 'api/auth/model';
import styles from './UserData.module.scss';
type ButtonClickEventProps = {
clickEvent: () => void;
};
+
+const useCheckEmailStep = () => {
+ const [isFilled, setIsFilled] = useState(false);
+ const checkEmailStep = (userData:RegisterData) => {
+ if (RegisterParam.pick({ email: true, password: true }).safeParse(userData).success) {
+ setIsFilled(true);
+ }
+ };
+ return { isFilled, checkEmailStep };
+};
export default function UserData({ clickEvent }:ButtonClickEventProps) {
const { isMobile } = useMediaQuery();
const [userData, setData] = useState
({});
- const { isDone, checkNextStep } = useCheckNext();
+ const { isDone, checkNextStep } = useCheckNextStep();
const { increaseStep } = useStepStore();
const [registerStep, setRegisterStep] = useState(0);
+ const { isFilled, checkEmailStep } = useCheckEmailStep();
useEffect(() => {
+ if (isMobile) {
+ checkEmailStep(userData);
+ }
checkNextStep(userData);
- }, [userData, checkNextStep]);
+ }, [userData, checkNextStep, isMobile, checkEmailStep]);
const goEmailAuth = () => {
setRegisterStep(1);
increaseStep();
};
+
return (
!isMobile
? (
@@ -53,8 +70,8 @@ export default function UserData({ clickEvent }:ButtonClickEventProps) {
{registerStep === 0
- ?
- : }
+ ?
+ : }
>
)
From 42bc0001c183a5de3802c19d9c550523bc9464dc Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Fri, 7 Jul 2023 18:55:46 +0900
Subject: [PATCH 25/52] =?UTF-8?q?refactor:=20console.log=20=EC=A0=9C?=
=?UTF-8?q?=EA=B1=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/component/UserId/index.tsx | 5 +----
src/page/Auth/Signup/component/UserPassword/index.tsx | 1 -
src/page/Auth/Signup/hooks/useCheckNextStep.ts | 1 -
src/page/Auth/Signup/index.tsx | 3 ---
4 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 54ebd7e1..340a5845 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -18,15 +18,12 @@ export default function UserId({ setId, userData }:EmailInputProps) {
const [isUsable, setUsable] = useState(null);
const { emailHandleSubmit, errors, emailDuplicateRegister } = useEmailDuplicateCheck();
const onSubmit:SubmitHandler = (data) => {
- console.log('이메일 중복 체크', data.email);
setId({ ...userData, email: data.email });
setUsable(!isUsable);
};
const mobileSubmit:SubmitHandler = (data) => {
if (isMobile) {
- console.log('이메일 중복 체크', data.email);
- setId({ ...userData, email: data.email });
- setUsable(!isUsable);
+ onSubmit(data);
}
};
return (
diff --git a/src/page/Auth/Signup/component/UserPassword/index.tsx b/src/page/Auth/Signup/component/UserPassword/index.tsx
index f09a0e4d..21c22f1a 100644
--- a/src/page/Auth/Signup/component/UserPassword/index.tsx
+++ b/src/page/Auth/Signup/component/UserPassword/index.tsx
@@ -21,7 +21,6 @@ export default function UserPassword({ setPassword, userData }:PasswordInputProp
passwordRegister, passwordConfirmRegister, errors, handleSubmit,
} = usePasswordConfirm();
const onSubmit:SubmitHandler = (data) => {
- console.log(data, userData, setPassword);
setPassword({ ...userData, password: data.password });
};
return (
diff --git a/src/page/Auth/Signup/hooks/useCheckNextStep.ts b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
index 123d5508..41eb6f9e 100644
--- a/src/page/Auth/Signup/hooks/useCheckNextStep.ts
+++ b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
@@ -6,7 +6,6 @@ export default function useCheckNextStep() {
const [isDone, setDone] = useState(false);
const checkNextStep = (userData:RegisterData) => {
- console.log(userData);
if (RegisterParam.safeParse(userData).success) {
setDone(true);
}
diff --git a/src/page/Auth/Signup/index.tsx b/src/page/Auth/Signup/index.tsx
index 1ec6f8a7..ae673378 100644
--- a/src/page/Auth/Signup/index.tsx
+++ b/src/page/Auth/Signup/index.tsx
@@ -22,12 +22,9 @@ export default function Signup() {
setRegisterStep(0);
}, [isMobile, setStep]);
useEffect(() => {
- console.log(step);
- console.log(registerStep);
}, [step, registerStep]);
const goNext = () => {
- console.log('asdf');
increaseStep();
setRegisterStep(registerStep + 1);
};
From d0dd400b0f343a23420029a2df95cc07e440a6bb Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Fri, 7 Jul 2023 19:13:04 +0900
Subject: [PATCH 26/52] =?UTF-8?q?fix:=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20?=
=?UTF-8?q?=EB=B7=B0=20=EC=9D=B8=EC=A6=9D=EB=B2=88=ED=98=B8=20=EC=9E=85?=
=?UTF-8?q?=EB=A0=A5=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=92=A4=EB=A1=9C?=
=?UTF-8?q?=EA=B0=80=EA=B8=B0=20=EC=95=88=EB=90=98=EB=8A=94=20=EB=B2=84?=
=?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/component/UserEmail/index.tsx | 2 +-
src/page/Auth/Signup/index.tsx | 1 +
src/page/Auth/Signup/view/UserDataPage/index.tsx | 8 +++++++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index 93526f87..45a6000e 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -78,7 +78,7 @@ export default function UserEmail({ clickEvent, userData, setAuthenticate }:Butt
- {userData?.isAuthentication === undefined && (
+ {!userData?.isAuthentication && (
인증번호가 일치하지 않습니다.
diff --git a/src/page/Auth/Signup/index.tsx b/src/page/Auth/Signup/index.tsx
index ae673378..17a59c1e 100644
--- a/src/page/Auth/Signup/index.tsx
+++ b/src/page/Auth/Signup/index.tsx
@@ -22,6 +22,7 @@ export default function Signup() {
setRegisterStep(0);
}, [isMobile, setStep]);
useEffect(() => {
+ console.log(registerStep, step);
}, [step, registerStep]);
const goNext = () => {
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 087cbc8c..0284514b 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -28,10 +28,16 @@ export default function UserData({ clickEvent }:ButtonClickEventProps) {
const { isMobile } = useMediaQuery();
const [userData, setData] = useState
({});
const { isDone, checkNextStep } = useCheckNextStep();
- const { increaseStep } = useStepStore();
+ const { increaseStep, step } = useStepStore();
const [registerStep, setRegisterStep] = useState(0);
const { isFilled, checkEmailStep } = useCheckEmailStep();
+ useEffect(() => {
+ if (step === 1) {
+ setRegisterStep(0);
+ }
+ }, [step]);
+
useEffect(() => {
if (isMobile) {
checkEmailStep(userData);
From c8bed6126147b85b768d0cb2a3ba2d2b1bb903c2 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Fri, 7 Jul 2023 19:23:07 +0900
Subject: [PATCH 27/52] =?UTF-8?q?feat:=20=EC=9D=B8=EC=A6=9D=EB=B2=88?=
=?UTF-8?q?=ED=98=B8=20=EC=9E=85=EB=A0=A5=20=EC=8B=A4=ED=8C=A8=20=EC=8B=9C?=
=?UTF-8?q?=20=EC=97=90=EB=9F=AC=20=EB=AC=B8=EA=B5=AC=20=EC=B6=9C=EB=A0=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/auth/model.ts | 5 +----
src/page/Auth/Signup/component/UserEmail/index.tsx | 2 +-
src/page/Auth/Signup/hooks/useCheckNextStep.ts | 2 ++
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/src/api/auth/model.ts b/src/api/auth/model.ts
index b2223f75..06088255 100644
--- a/src/api/auth/model.ts
+++ b/src/api/auth/model.ts
@@ -56,10 +56,7 @@ export type UserResponse = z.infer;
export const RegisterParam = z.object({
email: z.string(),
password: z.string(),
- isAuthentication: z.boolean().refine((value) => value === true, {
- message: 'isAuth는 true여야 합니다.',
- path: ['isAuth'],
- }),
+ isAuthentication: z.boolean().refine((value) => value === true),
});
export type RegisterParam = z.infer;
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index 45a6000e..fa2d6bbf 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -78,7 +78,7 @@ export default function UserEmail({ clickEvent, userData, setAuthenticate }:Butt
- {!userData?.isAuthentication && (
+ {userData.isAuthentication !== undefined && !userData.isAuthentication && (
인증번호가 일치하지 않습니다.
diff --git a/src/page/Auth/Signup/hooks/useCheckNextStep.ts b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
index 41eb6f9e..f59a62c0 100644
--- a/src/page/Auth/Signup/hooks/useCheckNextStep.ts
+++ b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
@@ -8,6 +8,8 @@ export default function useCheckNextStep() {
const checkNextStep = (userData:RegisterData) => {
if (RegisterParam.safeParse(userData).success) {
setDone(true);
+ } else {
+ setDone(false);
}
};
From 4da1621490b4cc2d0338340282cd9e88706e6dda Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Sun, 9 Jul 2023 20:35:19 +0900
Subject: [PATCH 28/52] =?UTF-8?q?feat:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?=
=?UTF-8?q?=EC=A4=91=EB=B3=B5=20=ED=99=95=EC=9D=B8=20api=20=EC=97=B0?=
=?UTF-8?q?=EA=B2=B0=20=EB=B0=8F=20=EA=B4=80=EB=A0=A8=20=EC=BB=A4=EC=8A=A4?=
=?UTF-8?q?=ED=85=80=20=ED=9B=85=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/auth/model.ts | 8 ----
src/api/register/index.ts | 8 ++++
src/api/register/model.ts | 19 ++++++++
.../Auth/Signup/component/UserEmail/index.tsx | 2 +-
.../Auth/Signup/component/UserId/index.tsx | 44 +++++++------------
.../Signup/hooks/useCheckEmailDuplicate.ts | 33 ++++++++++++++
.../Auth/Signup/hooks/useCheckNextStep.ts | 2 +-
...eEmailDataCheck.ts => useValidateEmail.ts} | 2 +-
.../Auth/Signup/view/UserDataPage/index.tsx | 3 +-
src/query/register.ts | 9 ++++
10 files changed, 89 insertions(+), 41 deletions(-)
create mode 100644 src/api/register/index.ts
create mode 100644 src/api/register/model.ts
create mode 100644 src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
rename src/page/Auth/Signup/hooks/{useEmailDataCheck.ts => useValidateEmail.ts} (93%)
create mode 100644 src/query/register.ts
diff --git a/src/api/auth/model.ts b/src/api/auth/model.ts
index 06088255..9e8b2a7c 100644
--- a/src/api/auth/model.ts
+++ b/src/api/auth/model.ts
@@ -52,11 +52,3 @@ export const UserResponse = z.object({
});
export type UserResponse = z.infer;
-
-export const RegisterParam = z.object({
- email: z.string(),
- password: z.string(),
- isAuthentication: z.boolean().refine((value) => value === true),
-});
-
-export type RegisterParam = z.infer;
diff --git a/src/api/register/index.ts b/src/api/register/index.ts
new file mode 100644
index 00000000..194d609d
--- /dev/null
+++ b/src/api/register/index.ts
@@ -0,0 +1,8 @@
+import { client } from 'api';
+
+const getEmailDuplicate = async (param: string) => {
+ const { status } = await client.get(`/user/check/email?address=${param}`);
+ return status;
+};
+
+export default getEmailDuplicate;
diff --git a/src/api/register/model.ts b/src/api/register/model.ts
new file mode 100644
index 00000000..b05787d8
--- /dev/null
+++ b/src/api/register/model.ts
@@ -0,0 +1,19 @@
+import { z } from 'zod';
+
+export const EmailParam = z.object({
+ email: z.string(),
+});
+
+export type EmailParam = z.infer;
+
+export const EmailDuplicateCheckResponse = z.object({});
+
+export type EmailDuplicateCheckResponse = z.infer;
+
+export const RegisterParam = z.object({
+ email: z.string(),
+ password: z.string(),
+ isAuthentication: z.boolean().refine((value) => value === true),
+});
+
+export type RegisterParam = z.infer;
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index fa2d6bbf..3e8ac292 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -5,7 +5,7 @@ import { useState } from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import { SubmitHandler } from 'react-hook-form';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
-import useEmailDuplicateCheck from 'page/Auth/Signup/hooks/useEmailDataCheck';
+import useEmailDuplicateCheck from 'page/Auth/Signup/hooks/useValidateEmail';
import useAuthCheck from 'page/Auth/Signup/hooks/useAuthCheck';
import styles from './UserEmail.module.scss';
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 340a5845..df00bf78 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -1,35 +1,24 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
-// eslint-disable-next-line import/no-extraneous-dependencies
-import { SubmitHandler } from 'react-hook-form';
-import useEmailDuplicateCheck from 'page/Auth/Signup/hooks/useEmailDataCheck';
-import { useState } from 'react';
+import useValidateEmail from 'page/Auth/Signup/hooks/useValidateEmail';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
+import useCheckEmailDuplicate from 'page/Auth/Signup/hooks/useCheckEmailDuplicate';
import styles from './UserId.module.scss';
interface EmailInputProps {
setId: (data:RegisterData) => void,
- userData?: RegisterData
+ userData: RegisterData
}
export default function UserId({ setId, userData }:EmailInputProps) {
const { isMobile } = useMediaQuery();
- const [isUsable, setUsable] = useState(null);
- const { emailHandleSubmit, errors, emailDuplicateRegister } = useEmailDuplicateCheck();
- const onSubmit:SubmitHandler = (data) => {
- setId({ ...userData, email: data.email });
- setUsable(!isUsable);
- };
- const mobileSubmit:SubmitHandler = (data) => {
- if (isMobile) {
- onSubmit(data);
- }
- };
+ const { emailHandleSubmit, errors, emailDuplicateRegister } = useValidateEmail();
+ const { status, onSubmit, onMobileSubmit } = useCheckEmailDuplicate(userData, setId, isMobile);
return (
- {errors.email && (
-
-
- {errors.email.message}
-
- )}
- { (isUsable !== null && !errors.email)
+ {errors.email ? (
+
+
+ {errors.email.message}
+
+ ) : (status === 'error' && !errors.email)
&& (
- <>
- {isUsable && 사용하실 수 있는 아이디 입니다.}
- {!isUsable && (
이미 가입된 이메일입니다.
- )}
- >
)}
+ {(status === 'success' && !errors.email)
+ && 사용하실 수 있는 아이디 입니다.}
+
);
}
diff --git a/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts b/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
new file mode 100644
index 00000000..abbabbf9
--- /dev/null
+++ b/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
@@ -0,0 +1,33 @@
+import useCheckDuplicate from 'query/register';
+import { useEffect, useState } from 'react';
+import { SubmitHandler } from 'react-hook-form';
+import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
+
+export default function useCheckEmailDuplicate(
+ userData:RegisterData,
+ setId: (data:RegisterData) => void,
+ isMobile: boolean,
+) {
+ const [email, setEmail] = useState('');
+ const { status, refetch } = useCheckDuplicate(email);
+
+ const onSubmit:SubmitHandler = (data) => {
+ setEmail(() => (data.email ? data.email : ''));
+ };
+ const onMobileSubmit:SubmitHandler = (data) => {
+ if (isMobile) {
+ onSubmit(data);
+ }
+ };
+ useEffect(() => {
+ if (email !== '') {
+ refetch();
+ }
+ }, [email, refetch]);
+ useEffect(() => {
+ if (status === 'success' && userData.email !== email) {
+ setId({ ...userData, email });
+ }
+ }, [status, setId, email, userData]);
+ return { status, onSubmit, onMobileSubmit };
+}
diff --git a/src/page/Auth/Signup/hooks/useCheckNextStep.ts b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
index f59a62c0..b8b32a28 100644
--- a/src/page/Auth/Signup/hooks/useCheckNextStep.ts
+++ b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
-import { RegisterParam } from 'api/auth/model';
+import { RegisterParam } from 'api/register/model';
export default function useCheckNextStep() {
const [isDone, setDone] = useState(false);
diff --git a/src/page/Auth/Signup/hooks/useEmailDataCheck.ts b/src/page/Auth/Signup/hooks/useValidateEmail.ts
similarity index 93%
rename from src/page/Auth/Signup/hooks/useEmailDataCheck.ts
rename to src/page/Auth/Signup/hooks/useValidateEmail.ts
index 4bdde833..efadbd37 100644
--- a/src/page/Auth/Signup/hooks/useEmailDataCheck.ts
+++ b/src/page/Auth/Signup/hooks/useValidateEmail.ts
@@ -4,7 +4,7 @@ import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
const REG_EX = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i;
-export default function useEmailDuplicateCheck() {
+export default function useValidateEmail() {
const {
register: emailRegister,
handleSubmit: emailHandleSubmit,
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 0284514b..930c7941 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -8,7 +8,7 @@ import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import useStepStore from 'store/useStepStore';
// eslint-disable-next-line import/no-named-as-default
import useCheckNextStep from 'page/Auth/Signup/hooks/useCheckNextStep';
-import { RegisterParam } from 'api/auth/model';
+import { RegisterParam } from 'api/register/model';
import styles from './UserData.module.scss';
type ButtonClickEventProps = {
@@ -43,6 +43,7 @@ export default function UserData({ clickEvent }:ButtonClickEventProps) {
checkEmailStep(userData);
}
checkNextStep(userData);
+ console.log(userData);
}, [userData, checkNextStep, isMobile, checkEmailStep]);
const goEmailAuth = () => {
diff --git a/src/query/register.ts b/src/query/register.ts
new file mode 100644
index 00000000..eaa85379
--- /dev/null
+++ b/src/query/register.ts
@@ -0,0 +1,9 @@
+import { useQuery } from '@tanstack/react-query';
+import getEmailDuplicate from 'api/register';
+
+const useCheckDuplicate = (email:string) => {
+ const { status, refetch } = useQuery(['emailDuplicateCheck', email], () => getEmailDuplicate(email), { enabled: false });
+ return { status, refetch };
+};
+
+export default useCheckDuplicate;
From 8a831f12445704e4b4b2604ae33149abb2bf7255 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Sun, 9 Jul 2023 21:31:41 +0900
Subject: [PATCH 29/52] =?UTF-8?q?feat:=20=EC=97=90=EB=9F=AC=20=ED=9B=84=20?=
=?UTF-8?q?=EB=8B=A4=EB=A5=B8=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20=EC=9E=85?=
=?UTF-8?q?=EB=A0=A5=20=EC=8B=9C=EC=97=90=20=EC=97=90=EB=9F=AC=20=EB=AC=B8?=
=?UTF-8?q?=EA=B5=AC=20=EC=97=86=EC=96=B4=EC=A7=80=EB=8F=84=EB=A1=9D=20?=
=?UTF-8?q?=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Auth/Signup/component/UserId/index.tsx | 30 +++++++++++--------
.../Signup/hooks/useCheckEmailDuplicate.ts | 4 ++-
.../Auth/Signup/hooks/useValidateEmail.ts | 5 ++--
3 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index df00bf78..444fd91a 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -13,12 +13,17 @@ interface EmailInputProps {
export default function UserId({ setId, userData }:EmailInputProps) {
const { isMobile } = useMediaQuery();
- const { emailHandleSubmit, errors, emailDuplicateRegister } = useValidateEmail();
- const { status, onSubmit, onMobileSubmit } = useCheckEmailDuplicate(userData, setId, isMobile);
+ const {
+ emailHandleSubmit, errors, emailDuplicateRegister, watch,
+ } = useValidateEmail();
+ const {
+ status, onSubmit, onMobileSubmit, email,
+ } = useCheckEmailDuplicate(userData, setId, isMobile);
+
return (
- {errors.email ? (
+ {errors.email && (
{errors.email.message}
- ) : (status === 'error' && !errors.email)
- && (
-
-
- 이미 가입된 이메일입니다.
-
- )}
- {(status === 'success' && !errors.email)
+ )}
+ {watch().email === email && !errors.email && status === 'error'
+ && (
+
+
+ 이미 가입된 이메일입니다.
+
+ )}
+ {watch().email === email && !errors.email && status === 'success'
&& 사용하실 수 있는 아이디 입니다.}
diff --git a/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts b/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
index abbabbf9..319386d0 100644
--- a/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
+++ b/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
@@ -29,5 +29,7 @@ export default function useCheckEmailDuplicate(
setId({ ...userData, email });
}
}, [status, setId, email, userData]);
- return { status, onSubmit, onMobileSubmit };
+ return {
+ status, onSubmit, onMobileSubmit, email,
+ };
}
diff --git a/src/page/Auth/Signup/hooks/useValidateEmail.ts b/src/page/Auth/Signup/hooks/useValidateEmail.ts
index efadbd37..327287b9 100644
--- a/src/page/Auth/Signup/hooks/useValidateEmail.ts
+++ b/src/page/Auth/Signup/hooks/useValidateEmail.ts
@@ -9,7 +9,8 @@ export default function useValidateEmail() {
register: emailRegister,
handleSubmit: emailHandleSubmit,
formState: { errors },
- } = useForm();
+ watch,
+ } = useForm({ mode: 'all' });
const emailDuplicateRegister = emailRegister('email', {
required: { value: true, message: '이메일을 입력해주세요.' },
pattern: {
@@ -18,6 +19,6 @@ export default function useValidateEmail() {
},
});
return {
- emailHandleSubmit, errors, emailDuplicateRegister,
+ emailHandleSubmit, errors, emailDuplicateRegister, watch,
};
}
From 2ce1a99c1fb99757130e69a174f1e39c11ced7f0 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Mon, 10 Jul 2023 16:40:32 +0900
Subject: [PATCH 30/52] =?UTF-8?q?feat:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?=
=?UTF-8?q?=EC=9D=B8=EC=A6=9D=20=EC=9A=94=EC=B2=AD=20api=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/register/index.ts | 15 +++++-
src/api/register/model.ts | 19 +++++--
.../Auth/Signup/component/UserEmail/index.tsx | 50 ++++++++-----------
src/page/Auth/Signup/hooks/useAuthCheck.ts | 45 +++++++++++++----
.../Signup/hooks/useCheckEmailDuplicate.ts | 2 +-
src/page/Auth/Signup/hooks/useEmailAuth.ts | 18 -------
.../Auth/Signup/hooks/useValidateEmail.ts | 2 +-
.../Auth/Signup/view/UserDataPage/index.tsx | 6 +--
src/query/register.ts | 30 +++++++++--
9 files changed, 117 insertions(+), 70 deletions(-)
delete mode 100644 src/page/Auth/Signup/hooks/useEmailAuth.ts
diff --git a/src/api/register/index.ts b/src/api/register/index.ts
index 194d609d..cfc71343 100644
--- a/src/api/register/index.ts
+++ b/src/api/register/index.ts
@@ -1,8 +1,19 @@
import { client } from 'api';
+import {
+ AuthCodeParam, AuthCodeResponse, EmailAuthParam, EmailAuthResponse,
+} from './model';
-const getEmailDuplicate = async (param: string) => {
+export const getEmailDuplicate = async (param: string) => {
const { status } = await client.get(`/user/check/email?address=${param}`);
return status;
};
-export default getEmailDuplicate;
+export const getEmailAuthCode = async (param: EmailAuthParam) => {
+ const { data } = await client.post('/owners/verification/email', param);
+ return EmailAuthResponse.parse(data);
+};
+
+export const verificationAuthCode = async (param:AuthCodeParam) => {
+ const { data } = await client.post('/owners/verification/code', param);
+ return AuthCodeResponse.parse(data);
+};
diff --git a/src/api/register/model.ts b/src/api/register/model.ts
index b05787d8..14dbd0b3 100644
--- a/src/api/register/model.ts
+++ b/src/api/register/model.ts
@@ -1,14 +1,23 @@
import { z } from 'zod';
-export const EmailParam = z.object({
- email: z.string(),
+export const EmailAuthParam = z.object({
+ address: z.string().email(),
});
+export type EmailAuthParam = z.infer;
-export type EmailParam = z.infer;
+export const EmailAuthResponse = z.string();
+export type EmailAuthResponse = z.infer;
-export const EmailDuplicateCheckResponse = z.object({});
+export const AuthCodeParam = z.object({
+ address: z.string().email(),
+ certificatoin_code: z.string(),
+});
+export type AuthCodeParam = z.infer;
-export type EmailDuplicateCheckResponse = z.infer;
+export const AuthCodeResponse = z.object({
+ token: z.string(),
+});
+export type AuthCodeResponse = z.infer;
export const RegisterParam = z.object({
email: z.string(),
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index 3e8ac292..02e3fee4 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -1,11 +1,8 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
-import { useState } from 'react';
-// eslint-disable-next-line import/no-extraneous-dependencies
-import { SubmitHandler } from 'react-hook-form';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
-import useEmailDuplicateCheck from 'page/Auth/Signup/hooks/useValidateEmail';
+import useValidateEmail from 'page/Auth/Signup/hooks/useValidateEmail';
import useAuthCheck from 'page/Auth/Signup/hooks/useAuthCheck';
import styles from './UserEmail.module.scss';
@@ -16,45 +13,42 @@ type ButtonClickEvent = {
};
export default function UserEmail({ clickEvent, userData, setAuthenticate }:ButtonClickEvent) {
const { isMobile } = useMediaQuery();
- const [isOpen, setOpen] = useState(false);
- const { emailHandleSubmit, errors, emailDuplicateRegister } = useEmailDuplicateCheck();
- const { authInput, checkAuthNumber } = useAuthCheck();
- const onSubmit:SubmitHandler = (data) => {
- setOpen(true);
- console.log(data.email);
- };
- const compareAuthNumber = () => {
- if (authInput.current?.value.length === 6) {
- // 인증 번호 입력
- if (checkAuthNumber('123456')) {
- setAuthenticate({ ...userData, isAuthentication: true });
- } else {
- setAuthenticate({ ...userData, isAuthentication: false });
- }
- }
- };
+ const {
+ emailHandleSubmit, errors, emailDuplicateRegister, watch,
+ } = useValidateEmail();
+ const {
+ isOpen, onSubmit, errorMessage, email, refetch,
+ } = useAuthCheck(userData.email ? userData.email : '', isMobile);
+ console.log(setAuthenticate, errorMessage);
return (
!isMobile
? (
- {userData.isAuthentication !== undefined && !userData.isAuthentication && (
-
-
- 인증번호가 일치하지 않습니다.
-
- )}
+ {verificateError &&
}
* 제한시간 5 : 00
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 444fd91a..e9ffc70c 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -1,9 +1,9 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
-import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import useValidateEmail from 'page/Auth/Signup/hooks/useValidateEmail';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import useCheckEmailDuplicate from 'page/Auth/Signup/hooks/useCheckEmailDuplicate';
+import ErrorMessage from 'page/Auth/Signup/component/ErrorMessage';
import styles from './UserId.module.scss';
interface EmailInputProps {
@@ -17,7 +17,7 @@ export default function UserId({ setId, userData }:EmailInputProps) {
emailHandleSubmit, errors, emailDuplicateRegister, watch,
} = useValidateEmail();
const {
- status, onSubmit, onMobileSubmit, email,
+ status, onSubmit, onMobileSubmit, email, errorMessage,
} = useCheckEmailDuplicate(userData, setId, isMobile);
return (
@@ -37,22 +37,11 @@ export default function UserId({ setId, userData }:EmailInputProps) {
/>
{!isMobile && }
- {errors.email && (
-
-
- {errors.email.message}
-
- )}
- {watch().email === email && !errors.email && status === 'error'
- && (
-
-
- 이미 가입된 이메일입니다.
-
- )}
- {watch().email === email && !errors.email && status === 'success'
+ {errors.email && }
+ {!errors.email && watch().email === email && errorMessage
+ && }
+ {!errors.email && watch().email === email && status === 'success'
&& 사용하실 수 있는 아이디 입니다.}
-
);
}
diff --git a/src/page/Auth/Signup/component/UserPassword/index.tsx b/src/page/Auth/Signup/component/UserPassword/index.tsx
index 21c22f1a..04c5f3a4 100644
--- a/src/page/Auth/Signup/component/UserPassword/index.tsx
+++ b/src/page/Auth/Signup/component/UserPassword/index.tsx
@@ -1,12 +1,12 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
import { ReactComponent as ShowIcon } from 'assets/svg/auth/show.svg';
import { ReactComponent as BlindIcon } from 'assets/svg/auth/blind.svg';
-import { ReactComponent as Warn } from 'assets/svg/auth/warning.svg';
import useBooleanState from 'utils/hooks/useBooleanState';
import usePasswordConfirm from 'page/Auth/Signup/hooks/usePasswordConfirm';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
// eslint-disable-next-line import/no-extraneous-dependencies
import { SubmitHandler } from 'react-hook-form';
+import ErrorMessage from 'page/Auth/Signup/component/ErrorMessage';
import styles from './UserPassword.module.scss';
interface PasswordInputProps {
@@ -39,11 +39,7 @@ export default function UserPassword({ setPassword, userData }:PasswordInputProp
{isBlind ? : }
)}
- {errors.password ? (
-
-
- {errors.password.message}
-
+ {errors.password ? (
) : * 특수문자 포함 영어와 숫자 조합 6~18 자리}
@@ -53,12 +49,7 @@ export default function UserPassword({ setPassword, userData }:PasswordInputProp
{isBlind ?
:
}
)}
- {errors.passwordConfirm && (
-
-
- {errors.passwordConfirm.message}
-
- )}
+ {errors.passwordConfirm &&
}
);
diff --git a/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts b/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
index f065f589..d7afb1bb 100644
--- a/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
+++ b/src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
@@ -9,7 +9,8 @@ export default function useCheckEmailDuplicate(
isMobile: boolean,
) {
const [email, setEmail] = useState('');
- const { status, refetch } = useCheckDuplicate(email);
+ const [errorMessage, setMessage] = useState('');
+ const { status, refetch, error } = useCheckDuplicate(email);
const onSubmit:SubmitHandler = (data) => {
setEmail(() => (data.email ? data.email : ''));
@@ -27,9 +28,11 @@ export default function useCheckEmailDuplicate(
useEffect(() => {
if (status === 'success' && userData.email !== email) {
setId({ ...userData, email });
+ } else {
+ setMessage(Object(error).response?.data.message);
}
- }, [status, setId, email, userData]);
+ }, [status, setId, email, userData, error]);
return {
- status, onSubmit, onMobileSubmit, email,
+ status, onSubmit, onMobileSubmit, email, errorMessage,
};
}
diff --git a/src/query/register.ts b/src/query/register.ts
index 19566c52..9041df6a 100644
--- a/src/query/register.ts
+++ b/src/query/register.ts
@@ -3,8 +3,8 @@ import { getEmailAuthCode, getEmailDuplicate, verificationAuthCode } from 'api/r
import useUploadToken from 'store/uploadToken';
export const useCheckDuplicate = (email:string) => {
- const { status, refetch } = useQuery(['emailDuplicateCheck', email], () => getEmailDuplicate(email), { enabled: false });
- return { status, refetch };
+ const { status, refetch, error } = useQuery(['emailDuplicateCheck', email], () => getEmailDuplicate(email), { enabled: false });
+ return { status, refetch, error };
};
export const useGenerateAuthCode = (email:string) => {
From d1c71bc6482c189675808f2b0595741ab9ea3bd3 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Tue, 11 Jul 2023 14:14:51 +0900
Subject: [PATCH 35/52] =?UTF-8?q?refactor:=20=EC=97=90=EB=9F=AC=EB=A9=94?=
=?UTF-8?q?=EC=84=B8=EC=A7=80=20=EB=B3=80=EC=88=98=EB=AA=85=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/page/Auth/Signup/component/UserEmail/index.tsx | 10 +++++-----
src/page/Auth/Signup/component/UserId/index.tsx | 12 ++++++------
.../Auth/Signup/component/UserPassword/index.tsx | 7 ++++---
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index 812e1614..4cf7edc1 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -16,10 +16,10 @@ type ButtonClickEvent = {
export default function UserEmail({ clickEvent, userData, setAuthenticate }:ButtonClickEvent) {
const { isMobile } = useMediaQuery();
const {
- emailHandleSubmit, errors, emailDuplicateRegister, watch,
+ emailHandleSubmit, errors: formErrors, emailDuplicateRegister, watch,
} = useValidateEmail();
const {
- isOpen, onSubmit, errorMessage, email, refetch,
+ isOpen, onSubmit, errorMessage: requestError, email, refetch,
} = useAuthCheck(userData.email ? userData.email : '', isMobile);
const {
verificationCode,
@@ -35,9 +35,9 @@ export default function UserEmail({ clickEvent, userData, setAuthenticate }:Butt
{isOpen && }
- { errors.email && }
- {(!errors.email && errorMessage && email === watch().email)
- && }
+ { formErrors.email && }
+ {(!formErrors.email && requestError && email === watch().email)
+ && }
{ verificateError && }
{isOpen ? (
<>
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index e9ffc70c..32578de1 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -14,10 +14,10 @@ interface EmailInputProps {
export default function UserId({ setId, userData }:EmailInputProps) {
const { isMobile } = useMediaQuery();
const {
- emailHandleSubmit, errors, emailDuplicateRegister, watch,
+ emailHandleSubmit, errors: formErros, emailDuplicateRegister, watch,
} = useValidateEmail();
const {
- status, onSubmit, onMobileSubmit, email, errorMessage,
+ status, onSubmit, onMobileSubmit, email, errorMessage: requestError,
} = useCheckEmailDuplicate(userData, setId, isMobile);
return (
@@ -37,10 +37,10 @@ export default function UserId({ setId, userData }:EmailInputProps) {
/>
{!isMobile && }
- {errors.email && }
- {!errors.email && watch().email === email && errorMessage
- && }
- {!errors.email && watch().email === email && status === 'success'
+ {formErros.email && }
+ {!formErros.email && watch().email === email && requestError
+ && }
+ {!formErros.email && watch().email === email && status === 'success'
&& 사용하실 수 있는 아이디 입니다.}
);
diff --git a/src/page/Auth/Signup/component/UserPassword/index.tsx b/src/page/Auth/Signup/component/UserPassword/index.tsx
index 04c5f3a4..b06d6a60 100644
--- a/src/page/Auth/Signup/component/UserPassword/index.tsx
+++ b/src/page/Auth/Signup/component/UserPassword/index.tsx
@@ -18,7 +18,7 @@ export default function UserPassword({ setPassword, userData }:PasswordInputProp
const { isMobile } = useMediaQuery();
const { value: isBlind, changeValue: changeIsBlind } = useBooleanState(true);
const {
- passwordRegister, passwordConfirmRegister, errors, handleSubmit,
+ passwordRegister, passwordConfirmRegister, errors: formErrors, handleSubmit,
} = usePasswordConfirm();
const onSubmit:SubmitHandler = (data) => {
setPassword({ ...userData, password: data.password });
@@ -39,7 +39,7 @@ export default function UserPassword({ setPassword, userData }:PasswordInputProp
{isBlind ? : }
)}
- {errors.password ? (
+ {formErrors.password ? (
) : * 특수문자 포함 영어와 숫자 조합 6~18 자리}
@@ -49,7 +49,8 @@ export default function UserPassword({ setPassword, userData }:PasswordInputProp
{isBlind ? : }
)}
- {errors.passwordConfirm && }
+ {formErrors.passwordConfirm
+ && }
);
From 3facbef94315933440ba08fcb9c135fedbd5913c Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Tue, 11 Jul 2023 14:17:01 +0900
Subject: [PATCH 36/52] =?UTF-8?q?refactor:=20console.log=20=EC=A0=9C?=
=?UTF-8?q?=EA=B1=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/component/UserPassword/index.tsx | 2 +-
src/page/Auth/Signup/hooks/usePasswordConfirm.ts | 1 -
src/page/Auth/Signup/hooks/useValidateEmail.ts | 1 -
src/page/Auth/Signup/index.tsx | 3 ---
src/page/Auth/Signup/view/UserDataPage/index.tsx | 1 -
5 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserPassword/index.tsx b/src/page/Auth/Signup/component/UserPassword/index.tsx
index b06d6a60..a0cb5bc5 100644
--- a/src/page/Auth/Signup/component/UserPassword/index.tsx
+++ b/src/page/Auth/Signup/component/UserPassword/index.tsx
@@ -4,7 +4,7 @@ import { ReactComponent as BlindIcon } from 'assets/svg/auth/blind.svg';
import useBooleanState from 'utils/hooks/useBooleanState';
import usePasswordConfirm from 'page/Auth/Signup/hooks/usePasswordConfirm';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
-// eslint-disable-next-line import/no-extraneous-dependencies
+
import { SubmitHandler } from 'react-hook-form';
import ErrorMessage from 'page/Auth/Signup/component/ErrorMessage';
import styles from './UserPassword.module.scss';
diff --git a/src/page/Auth/Signup/hooks/usePasswordConfirm.ts b/src/page/Auth/Signup/hooks/usePasswordConfirm.ts
index 94f59b8e..6f43bb6a 100644
--- a/src/page/Auth/Signup/hooks/usePasswordConfirm.ts
+++ b/src/page/Auth/Signup/hooks/usePasswordConfirm.ts
@@ -1,4 +1,3 @@
-// eslint-disable-next-line import/no-extraneous-dependencies
import { useForm } from 'react-hook-form';
const REG_EX = /^(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,18}$/i;
diff --git a/src/page/Auth/Signup/hooks/useValidateEmail.ts b/src/page/Auth/Signup/hooks/useValidateEmail.ts
index b873f867..df2ea993 100644
--- a/src/page/Auth/Signup/hooks/useValidateEmail.ts
+++ b/src/page/Auth/Signup/hooks/useValidateEmail.ts
@@ -1,4 +1,3 @@
-// eslint-disable-next-line import/no-extraneous-dependencies
import { useForm } from 'react-hook-form';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
diff --git a/src/page/Auth/Signup/index.tsx b/src/page/Auth/Signup/index.tsx
index 17a59c1e..5d79b1fe 100644
--- a/src/page/Auth/Signup/index.tsx
+++ b/src/page/Auth/Signup/index.tsx
@@ -21,9 +21,6 @@ export default function Signup() {
setStep(0);
setRegisterStep(0);
}, [isMobile, setStep]);
- useEffect(() => {
- console.log(registerStep, step);
- }, [step, registerStep]);
const goNext = () => {
increaseStep();
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 18b93c5a..65bdbc92 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -43,7 +43,6 @@ export default function UserData({ clickEvent }:ButtonClickEventProps) {
checkEmailStep(userData);
}
checkNextStep(userData);
- console.log(userData);
}, [userData, checkNextStep, isMobile, checkEmailStep]);
const goEmailAuth = () => {
From 2272af9d7c1cd69941b7ca75c3f03d2076bc8b3c Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Tue, 11 Jul 2023 15:46:04 +0900
Subject: [PATCH 37/52] =?UTF-8?q?feat:=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?=
=?UTF-8?q?=EC=9D=B8=EC=A6=9D=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20=EB=B7=B0=20?=
=?UTF-8?q?=EB=8B=A4=EC=9D=8C=20=EB=B2=84=ED=8A=BC=20=EB=A1=9C=EC=A7=81=20?=
=?UTF-8?q?=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Auth/Signup/component/UserEmail/index.tsx | 8 ++--
.../Auth/Signup/hooks/useCheckNextStep.ts | 2 -
src/page/Auth/Signup/hooks/useRegisterStep.ts | 45 +++++++++++++++++++
src/page/Auth/Signup/index.tsx | 36 +++------------
.../Auth/Signup/view/UserDataPage/index.tsx | 12 +++--
5 files changed, 59 insertions(+), 44 deletions(-)
create mode 100644 src/page/Auth/Signup/hooks/useRegisterStep.ts
diff --git a/src/page/Auth/Signup/component/UserEmail/index.tsx b/src/page/Auth/Signup/component/UserEmail/index.tsx
index 4cf7edc1..80771aa3 100644
--- a/src/page/Auth/Signup/component/UserEmail/index.tsx
+++ b/src/page/Auth/Signup/component/UserEmail/index.tsx
@@ -8,12 +8,12 @@ import ErrorMessage from 'page/Auth/Signup/component/ErrorMessage';
import styles from './UserEmail.module.scss';
type ButtonClickEvent = {
- clickEvent?: () => void | null,
+ goNext?: () => void;
userData: RegisterData,
setAuthenticate: (data:RegisterData) => void
};
-export default function UserEmail({ clickEvent, userData, setAuthenticate }:ButtonClickEvent) {
+export default function UserEmail({ userData, setAuthenticate }:ButtonClickEvent) {
const { isMobile } = useMediaQuery();
const {
emailHandleSubmit, errors: formErrors, emailDuplicateRegister, watch,
@@ -68,14 +68,14 @@ export default function UserEmail({ clickEvent, userData, setAuthenticate }:Butt
발송된 인증번호 6자리를 입력해 주세요
-
+
{verificateError && }
* 제한시간 5 : 00
-
+
>
)
diff --git a/src/page/Auth/Signup/hooks/useCheckNextStep.ts b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
index b8b32a28..66240da8 100644
--- a/src/page/Auth/Signup/hooks/useCheckNextStep.ts
+++ b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
@@ -8,8 +8,6 @@ export default function useCheckNextStep() {
const checkNextStep = (userData:RegisterData) => {
if (RegisterParam.safeParse(userData).success) {
setDone(true);
- } else {
- setDone(false);
}
};
diff --git a/src/page/Auth/Signup/hooks/useRegisterStep.ts b/src/page/Auth/Signup/hooks/useRegisterStep.ts
new file mode 100644
index 00000000..172b1c2d
--- /dev/null
+++ b/src/page/Auth/Signup/hooks/useRegisterStep.ts
@@ -0,0 +1,45 @@
+import { useCallback, useEffect, useState } from 'react';
+import useUploadToken from 'store/uploadToken';
+import useStepStore from 'store/useStepStore';
+import useMediaQuery from 'utils/hooks/useMediaQuery';
+
+export default function useRegisterStep() {
+ const {
+ step, setStep, increaseStep, decreaseStep,
+ } = useStepStore();
+ const { isMobile } = useMediaQuery();
+ const [registerStep, setRegisterStep] = useState(0);
+ const { uploadToken } = useUploadToken();
+
+ useEffect(() => {
+ setStep(0);
+ setRegisterStep(0);
+ }, [isMobile, setStep]);
+
+ const goNext = useCallback(() => {
+ increaseStep();
+ setRegisterStep((regiStep) => regiStep + 1);
+ }, [increaseStep, setRegisterStep]);
+
+ useEffect(() => {
+ if (uploadToken) {
+ goNext();
+ }
+ }, [uploadToken, goNext]);
+
+ const goPrev = () => {
+ if (registerStep === 2) {
+ setRegisterStep(1);
+ setStep(1);
+ } else if (step === 2) {
+ setStep(1);
+ setRegisterStep(1);
+ } else {
+ setRegisterStep(registerStep - 1);
+ decreaseStep();
+ }
+ };
+ return {
+ goNext, registerStep, goPrev, step,
+ };
+}
diff --git a/src/page/Auth/Signup/index.tsx b/src/page/Auth/Signup/index.tsx
index 5d79b1fe..10e5b829 100644
--- a/src/page/Auth/Signup/index.tsx
+++ b/src/page/Auth/Signup/index.tsx
@@ -1,51 +1,25 @@
-import { useEffect, useState } from 'react';
import useMediaQuery from 'utils/hooks/useMediaQuery';
import { ReactComponent as Logo } from 'assets/svg/auth/koin-logo.svg';
import { ReactComponent as Back } from 'assets/svg/common/back-arrow.svg';
import { Link } from 'react-router-dom';
import ProgressBar from 'component/common/ProgressBar';
-import useStepStore from 'store/useStepStore';
import OwnerData from './view/OwnerDataPage';
import TermsOfService from './view/TermsOfServicePage';
import UserData from './view/UserDataPage';
import styles from './SignUp.module.scss';
import Complete from './view/CompletePage';
+import useRegisterStep from './hooks/useRegisterStep';
export default function Signup() {
- const {
- step, setStep, increaseStep, decreaseStep,
- } = useStepStore();
const { isMobile } = useMediaQuery();
- const [registerStep, setRegisterStep] = useState(0);
- useEffect(() => {
- setStep(0);
- setRegisterStep(0);
- }, [isMobile, setStep]);
-
- const goNext = () => {
- increaseStep();
- setRegisterStep(registerStep + 1);
- };
-
- const goPrev = () => {
- if (registerStep === 2) {
- setRegisterStep(1);
- setStep(1);
- } else if (step === 2) {
- setStep(1);
- setRegisterStep(1);
- } else {
- setRegisterStep(registerStep - 1);
- decreaseStep();
- }
- };
-
+ const {
+ goNext, registerStep, goPrev, step,
+ } = useRegisterStep();
const STEPS = [
,
- ,
+ ,
,
];
-
return (
{!isMobile
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 65bdbc92..663d44c6 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -6,13 +6,12 @@ import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { useEffect, useState } from 'react';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import useStepStore from 'store/useStepStore';
-// eslint-disable-next-line import/no-named-as-default
import useCheckNextStep from 'page/Auth/Signup/hooks/useCheckNextStep';
import { RegisterParam } from 'api/register/model';
import styles from './UserData.module.scss';
type ButtonClickEventProps = {
- clickEvent: () => void;
+ goNext: () => void;
};
const useCheckEmailStep = () => {
@@ -24,7 +23,7 @@ const useCheckEmailStep = () => {
};
return { isFilled, checkEmailStep };
};
-export default function UserData({ clickEvent }:ButtonClickEventProps) {
+export default function UserData({ goNext }:ButtonClickEventProps) {
const { isMobile } = useMediaQuery();
const [userData, setData] = useState
({});
const { isDone, checkNextStep } = useCheckNextStep();
@@ -60,7 +59,7 @@ export default function UserData({ clickEvent }:ButtonClickEventProps) {
-
+
>
)
@@ -72,12 +71,11 @@ export default function UserData({ clickEvent }:ButtonClickEventProps) {
>
- ) : }
+ ) : }
{registerStep === 0 && }
- {registerStep > 1 && }
-
+ {registerStep > 1 && }
>
)
From bef5cc37bdb67b22d1cd668f0ea09d99beb174e9 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Tue, 11 Jul 2023 15:50:37 +0900
Subject: [PATCH 38/52] =?UTF-8?q?fix:=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20?=
=?UTF-8?q?=EB=B7=B0=20=EB=8B=A4=EC=9D=8C=20=EB=B2=84=ED=8A=BC=20=EB=A1=9C?=
=?UTF-8?q?=EC=A7=81=20pc=20=EB=B7=B0=EC=97=90=EC=84=9C=20=EC=98=88?=
=?UTF-8?q?=EC=99=B8=EC=B2=98=EB=A6=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/hooks/useRegisterStep.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/page/Auth/Signup/hooks/useRegisterStep.ts b/src/page/Auth/Signup/hooks/useRegisterStep.ts
index 172b1c2d..58a1307c 100644
--- a/src/page/Auth/Signup/hooks/useRegisterStep.ts
+++ b/src/page/Auth/Signup/hooks/useRegisterStep.ts
@@ -22,10 +22,10 @@ export default function useRegisterStep() {
}, [increaseStep, setRegisterStep]);
useEffect(() => {
- if (uploadToken) {
+ if (uploadToken && isMobile) {
goNext();
}
- }, [uploadToken, goNext]);
+ }, [uploadToken, goNext, isMobile]);
const goPrev = () => {
if (registerStep === 2) {
From ba9e0d0938312b493be51fc680ff51ab82859957 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Wed, 12 Jul 2023 19:39:22 +0900
Subject: [PATCH 39/52] =?UTF-8?q?feat:=20=EC=A4=91=EB=B3=B5=EB=90=98?=
=?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20id=EC=9D=BC=EC=8B=9C=EC=97=90?=
=?UTF-8?q?=20id=20=EC=9D=B8=ED=92=8B=20disabled=20=EC=B2=98=EB=A6=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/component/UserId/index.tsx | 1 +
src/page/Auth/Signup/hooks/useValidateEmail.ts | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 32578de1..6df0e0bd 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -34,6 +34,7 @@ export default function UserId({ setId, userData }:EmailInputProps) {
type="text"
placeholder={isMobile ? '이메일' : '이메일 형식 아이디 입력(필수)'}
{...emailDuplicateRegister}
+ disabled={status === 'success'}
/>
{!isMobile && }
diff --git a/src/page/Auth/Signup/hooks/useValidateEmail.ts b/src/page/Auth/Signup/hooks/useValidateEmail.ts
index df2ea993..9f86a00b 100644
--- a/src/page/Auth/Signup/hooks/useValidateEmail.ts
+++ b/src/page/Auth/Signup/hooks/useValidateEmail.ts
@@ -9,7 +9,7 @@ export default function useValidateEmail() {
handleSubmit: emailHandleSubmit,
formState: { errors },
watch,
- } = useForm();
+ } = useForm({ mode: 'onSubmit' });
const emailDuplicateRegister = emailRegister('email', {
required: { value: true, message: '이메일을 입력해주세요.' },
pattern: {
From dfeecfa5f24f3c7a0e6f528bc2ccf5691fbc2a9e Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Wed, 12 Jul 2023 21:01:10 +0900
Subject: [PATCH 40/52] =?UTF-8?q?refactor:=20=EC=9D=B4=EB=A9=94=EC=9D=BC?=
=?UTF-8?q?=20=EC=A4=91=EB=B3=B5=20=EC=B2=B4=ED=81=AC=20api=20request,=20r?=
=?UTF-8?q?esponse=20model=20=EB=B3=80=EC=88=98=EB=AA=85=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/api/register/index.ts | 10 +++++-----
src/{api/register/model.ts => model/register/index.ts} | 8 ++++----
src/page/Auth/Signup/hooks/useCheckNextStep.ts | 2 +-
src/page/Auth/Signup/view/UserDataPage/index.tsx | 2 +-
4 files changed, 11 insertions(+), 11 deletions(-)
rename src/{api/register/model.ts => model/register/index.ts} (70%)
diff --git a/src/api/register/index.ts b/src/api/register/index.ts
index cfc71343..c143dfea 100644
--- a/src/api/register/index.ts
+++ b/src/api/register/index.ts
@@ -1,16 +1,16 @@
import { client } from 'api';
import {
- AuthCodeParam, AuthCodeResponse, EmailAuthParam, EmailAuthResponse,
-} from './model';
+ AuthCodeParam, AuthCodeResponse, EmailRegisterParam, EmailRegisterResponse,
+} from 'model/register';
export const getEmailDuplicate = async (param: string) => {
const { status } = await client.get(`/user/check/email?address=${param}`);
return status;
};
-export const getEmailAuthCode = async (param: EmailAuthParam) => {
- const { data } = await client.post('/owners/verification/email', param);
- return EmailAuthResponse.parse(data);
+export const getEmailAuthCode = async (param: EmailRegisterParam) => {
+ const { data } = await client.post('/owners/verification/email', param);
+ return EmailRegisterResponse.parse(data);
};
export const verificationAuthCode = async (param:AuthCodeParam) => {
diff --git a/src/api/register/model.ts b/src/model/register/index.ts
similarity index 70%
rename from src/api/register/model.ts
rename to src/model/register/index.ts
index d1ffdc52..8613e5d9 100644
--- a/src/api/register/model.ts
+++ b/src/model/register/index.ts
@@ -1,12 +1,12 @@
import { z } from 'zod';
-export const EmailAuthParam = z.object({
+export const EmailRegisterParam = z.object({
address: z.string().email(),
});
-export type EmailAuthParam = z.infer;
+export type EmailRegisterParam = z.infer;
-export const EmailAuthResponse = z.string();
-export type EmailAuthResponse = z.infer;
+export const EmailRegisterResponse = z.string();
+export type EmailRegisterResponse = z.infer;
export const AuthCodeParam = z.object({
address: z.string().email(),
diff --git a/src/page/Auth/Signup/hooks/useCheckNextStep.ts b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
index 66240da8..342d6f90 100644
--- a/src/page/Auth/Signup/hooks/useCheckNextStep.ts
+++ b/src/page/Auth/Signup/hooks/useCheckNextStep.ts
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
-import { RegisterParam } from 'api/register/model';
+import { RegisterParam } from 'model/register';
export default function useCheckNextStep() {
const [isDone, setDone] = useState(false);
diff --git a/src/page/Auth/Signup/view/UserDataPage/index.tsx b/src/page/Auth/Signup/view/UserDataPage/index.tsx
index 663d44c6..4b7b7782 100644
--- a/src/page/Auth/Signup/view/UserDataPage/index.tsx
+++ b/src/page/Auth/Signup/view/UserDataPage/index.tsx
@@ -7,7 +7,7 @@ import { useEffect, useState } from 'react';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import useStepStore from 'store/useStepStore';
import useCheckNextStep from 'page/Auth/Signup/hooks/useCheckNextStep';
-import { RegisterParam } from 'api/register/model';
+import { RegisterParam } from 'model/register';
import styles from './UserData.module.scss';
type ButtonClickEventProps = {
From a92dbc5a7aba86416447efa416735159a35b6dce Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Wed, 12 Jul 2023 21:02:28 +0900
Subject: [PATCH 41/52] =?UTF-8?q?refactor:=20useGenerateAuthCode=20query?=
=?UTF-8?q?=20key=20=EC=98=A4=ED=83=80=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/query/register.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/query/register.ts b/src/query/register.ts
index 9041df6a..6d988f97 100644
--- a/src/query/register.ts
+++ b/src/query/register.ts
@@ -11,7 +11,7 @@ export const useGenerateAuthCode = (email:string) => {
const {
status, refetch, isError, error,
} = useQuery(
- ['genrateEmailAuthCode', email],
+ ['generateEmailAuthCode', email],
() => getEmailAuthCode({ address: email }),
{
enabled: false,
From 7dc36a207804703a35613a1309d6f95787822a36 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Wed, 12 Jul 2023 21:28:38 +0900
Subject: [PATCH 42/52] =?UTF-8?q?style:=20y=EC=B6=95=20=EC=8A=A4=ED=81=AC?=
=?UTF-8?q?=EB=A1=A4=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=A0=9C=EA=B1=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/SignUp.module.scss | 7 ++++++-
.../view/TermsOfServicePage/TermsOfService.module.scss | 5 +++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/page/Auth/Signup/SignUp.module.scss b/src/page/Auth/Signup/SignUp.module.scss
index 96fffe0f..853fc4b2 100644
--- a/src/page/Auth/Signup/SignUp.module.scss
+++ b/src/page/Auth/Signup/SignUp.module.scss
@@ -25,9 +25,14 @@
@include media.media-breakpoint-down(mobile) {
width: 78%;
- height: 80vh;
+ height: 79vh;
margin-bottom: 60px;
overflow-y: scroll;
+ -ms-overflow-style: none; /* 인터넷 익스플로러 */
+ scrollbar-width: none; /* 파이어폭스 */
+ &::-webkit-scrollbar {
+ display: none;
+ }
}
&__steps {
diff --git a/src/page/Auth/Signup/view/TermsOfServicePage/TermsOfService.module.scss b/src/page/Auth/Signup/view/TermsOfServicePage/TermsOfService.module.scss
index f0abb57d..d8b0e855 100644
--- a/src/page/Auth/Signup/view/TermsOfServicePage/TermsOfService.module.scss
+++ b/src/page/Auth/Signup/view/TermsOfServicePage/TermsOfService.module.scss
@@ -101,6 +101,11 @@
padding: 16px;
margin-bottom: 18px;
white-space: pre-line;
+ -ms-overflow-style: none; /* 인터넷 익스플로러 */
+ scrollbar-width: none; /* 파이어폭스 */
+ &::-webkit-scrollbar {
+ display: none;
+ }
@include media.media-breakpoint-down(mobile) {
border: 1px dashed #d2dae2;
From b6e144c45ecd8c5a9300ef9fb6573cef2c5346d5 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Wed, 12 Jul 2023 21:42:38 +0900
Subject: [PATCH 43/52] =?UTF-8?q?refactor:=20=EB=92=A4=EB=A1=9C=EA=B0=80?=
=?UTF-8?q?=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20common=EC=9D=98=20PreviousStep?=
=?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/component/UserId/index.tsx | 1 -
src/page/Auth/Signup/index.tsx | 7 ++-----
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserId/index.tsx b/src/page/Auth/Signup/component/UserId/index.tsx
index 6df0e0bd..32578de1 100644
--- a/src/page/Auth/Signup/component/UserId/index.tsx
+++ b/src/page/Auth/Signup/component/UserId/index.tsx
@@ -34,7 +34,6 @@ export default function UserId({ setId, userData }:EmailInputProps) {
type="text"
placeholder={isMobile ? '이메일' : '이메일 형식 아이디 입력(필수)'}
{...emailDuplicateRegister}
- disabled={status === 'success'}
/>
{!isMobile && }
diff --git a/src/page/Auth/Signup/index.tsx b/src/page/Auth/Signup/index.tsx
index 10e5b829..59b36541 100644
--- a/src/page/Auth/Signup/index.tsx
+++ b/src/page/Auth/Signup/index.tsx
@@ -3,6 +3,7 @@ import { ReactComponent as Logo } from 'assets/svg/auth/koin-logo.svg';
import { ReactComponent as Back } from 'assets/svg/common/back-arrow.svg';
import { Link } from 'react-router-dom';
import ProgressBar from 'component/common/ProgressBar';
+import PreviousStep from 'component/common/Auth/PreviousStep';
import OwnerData from './view/OwnerDataPage';
import TermsOfService from './view/TermsOfServicePage';
import UserData from './view/UserDataPage';
@@ -44,11 +45,7 @@ export default function Signup() {
- ) : (
-
-
-
- )}
+ ) : }
사장님용
From c8d744d888b512d2824204b89fa451e983a103ab Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Mon, 25 Sep 2023 15:36:56 +0900
Subject: [PATCH 44/52] =?UTF-8?q?feat:=20=EC=95=BD=EA=B4=80=20=EB=AA=A8?=
=?UTF-8?q?=EB=91=90=20=EB=8F=99=EC=9D=98=20=EC=8B=9C=20=EC=8A=A4=ED=81=AC?=
=?UTF-8?q?=EB=A1=A4=20=EC=B5=9C=ED=95=98=EB=8B=A8=EC=9C=BC=EB=A1=9C=20?=
=?UTF-8?q?=EC=9D=B4=EB=8F=99=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20?=
=?UTF-8?q?=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/SignUp.module.scss | 1 -
.../Auth/Signup/hooks/usePasswordConfirm.ts | 2 +-
src/page/Auth/Signup/index.tsx | 6 ++--
.../Signup/view/TermsOfServicePage/index.tsx | 34 +++++++++++++++----
4 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/src/page/Auth/Signup/SignUp.module.scss b/src/page/Auth/Signup/SignUp.module.scss
index 853fc4b2..8991256a 100644
--- a/src/page/Auth/Signup/SignUp.module.scss
+++ b/src/page/Auth/Signup/SignUp.module.scss
@@ -28,7 +28,6 @@
height: 79vh;
margin-bottom: 60px;
overflow-y: scroll;
- -ms-overflow-style: none; /* 인터넷 익스플로러 */
scrollbar-width: none; /* 파이어폭스 */
&::-webkit-scrollbar {
display: none;
diff --git a/src/page/Auth/Signup/hooks/usePasswordConfirm.ts b/src/page/Auth/Signup/hooks/usePasswordConfirm.ts
index 6f43bb6a..f1148f65 100644
--- a/src/page/Auth/Signup/hooks/usePasswordConfirm.ts
+++ b/src/page/Auth/Signup/hooks/usePasswordConfirm.ts
@@ -13,7 +13,7 @@ export default function usePasswordConfirm() {
formState: { errors },
getValues,
handleSubmit,
- } = useForm({ mode: 'onBlur' });
+ } = useForm({ mode: 'onChange' });
const passwordRegister = register('password', {
required: { value: true, message: '비밀번호를 입력해주세요.' },
diff --git a/src/page/Auth/Signup/index.tsx b/src/page/Auth/Signup/index.tsx
index 59b36541..fc9e04b7 100644
--- a/src/page/Auth/Signup/index.tsx
+++ b/src/page/Auth/Signup/index.tsx
@@ -4,6 +4,7 @@ import { ReactComponent as Back } from 'assets/svg/common/back-arrow.svg';
import { Link } from 'react-router-dom';
import ProgressBar from 'component/common/ProgressBar';
import PreviousStep from 'component/common/Auth/PreviousStep';
+import { useRef } from 'react';
import OwnerData from './view/OwnerDataPage';
import TermsOfService from './view/TermsOfServicePage';
import UserData from './view/UserDataPage';
@@ -16,8 +17,9 @@ export default function Signup() {
const {
goNext, registerStep, goPrev, step,
} = useRegisterStep();
+ const termsRef = useRef(null);
const STEPS = [
- ,
+ ,
,
,
];
@@ -46,7 +48,7 @@ export default function Signup() {
) : }
-
+
사장님용
diff --git a/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx b/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx
index a1b7d8e4..32147d7d 100644
--- a/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx
+++ b/src/page/Auth/Signup/view/TermsOfServicePage/index.tsx
@@ -2,18 +2,19 @@ import { Link } from 'react-router-dom';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import useMediaQuery from 'utils/hooks/useMediaQuery';
import TERMS from 'page/Auth/Signup/constant/terms';
-import { useEffect, useState } from 'react';
+import React, { useEffect, useRef, useState } from 'react';
import styles from './TermsOfService.module.scss';
type ButtonClickEventProps = {
clickEvent: () => void;
+ termsRef: React.RefObject
};
-const useTermCheck = () => {
+const useTermCheck = (ref:React.RefObject) => {
const [isUserTermAgree, setUserTermAgree] = useState(false);
const [isKoinTermAgree, setKoinTermAgree] = useState(false);
const [isAllAgree, setAllAgree] = useState(false);
-
+ const sectionRef = useRef(null);
const checkAll = () => {
if (isAllAgree) {
setUserTermAgree(false);
@@ -26,21 +27,40 @@ const useTermCheck = () => {
useEffect(() => {
setAllAgree(isKoinTermAgree && isUserTermAgree);
}, [isKoinTermAgree, isUserTermAgree]);
+ useEffect(() => {
+ if (isAllAgree && ref.current) {
+ console.log(
+ ref.current.scrollHeight,
+ ref.current.scrollTop,
+ );
+ ref.current.scrollTo({ top: ref.current.scrollHeight });
+ console.log(
+ ref.current.scrollHeight,
+ ref.current.scrollTop,
+ );
+ }
+ }, [isAllAgree, ref]);
return {
- isUserTermAgree, setUserTermAgree, isKoinTermAgree, setKoinTermAgree, isAllAgree, checkAll,
+ isUserTermAgree,
+ setUserTermAgree,
+ isKoinTermAgree,
+ setKoinTermAgree,
+ isAllAgree,
+ checkAll,
+ sectionRef,
};
};
-export default function TermsOfService({ clickEvent }:ButtonClickEventProps) {
+export default function TermsOfService({ clickEvent, termsRef }:ButtonClickEventProps) {
const { isMobile } = useMediaQuery();
const USER_TERM = TERMS[0];
const KOIN_TERM = TERMS[1];
const {
isUserTermAgree, setUserTermAgree, isKoinTermAgree, setKoinTermAgree, isAllAgree, checkAll,
- } = useTermCheck();
+ } = useTermCheck(termsRef);
return (
<>
-
+
-
+
diff --git a/src/store/useStepStore.ts b/src/store/useStepStore.ts
index 81cf1d73..e82c991a 100644
--- a/src/store/useStepStore.ts
+++ b/src/store/useStepStore.ts
@@ -6,7 +6,6 @@ interface StepStore {
setStep: (step: number) => void;
decreaseStep: () => void;
increaseStep: () => void;
- increaseStep: () => void
}
const useStepStore = create((set) => ({
TOTAL_STEP: 4,
From 493e3848b3d04199c153262fc61aa57272d1e071 Mon Sep 17 00:00:00 2001
From: HAEROOL <71335694+HAEROOL@users.noreply.github.com>
Date: Mon, 23 Oct 2023 21:56:09 +0900
Subject: [PATCH 52/52] =?UTF-8?q?fix:=20=EB=B9=84=EB=B0=80=EB=B2=88?=
=?UTF-8?q?=ED=98=B8=20input=20=EC=A0=95=EA=B7=9C=ED=91=9C=ED=98=84?=
=?UTF-8?q?=EC=8B=9D=20=EB=A7=8C=EC=A1=B1=20=EC=8B=9C=20=EB=B0=94=EB=A1=9C?=
=?UTF-8?q?=20=EB=8B=A4=EC=9D=8C=EC=9C=BC=EB=A1=9C=20=EB=84=98=EC=96=B4?=
=?UTF-8?q?=EA=B0=80=EB=8A=94=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/page/Auth/Signup/component/UserPassword/index.tsx | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/page/Auth/Signup/component/UserPassword/index.tsx b/src/page/Auth/Signup/component/UserPassword/index.tsx
index 442ca881..e277cb42 100644
--- a/src/page/Auth/Signup/component/UserPassword/index.tsx
+++ b/src/page/Auth/Signup/component/UserPassword/index.tsx
@@ -24,7 +24,7 @@ export default function UserPassword({ setPassword, userData }:PasswordInputProp
setPassword({ ...userData, password: data.password });
};
return (
-
+
{!isMobile &&
비밀번호}
) : * 특수문자 포함 영어와 숫자 조합 6~18 자리}
-