Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[회원가입] 회원가입 페이지 API 연동 #34

Merged
merged 47 commits into from
Jan 6, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
35d9228
Merge pull request #15 from BCSDLab/feature/add-signup-page
HAEROOL Nov 1, 2023
6fa6184
Merge branch 'feature/add-signup-page' of https://github.com/BCSDLab/…
HAEROOL Nov 1, 2023
cdc2244
feat: 개인 연락처 input 추가
HAEROOL Nov 1, 2023
ef51715
feat: 가게 이름 입력 input 추가
HAEROOL Nov 1, 2023
82125fe
style: 가게 검색 버튼 모바일, 데스크톱 스타일 수정
HAEROOL Nov 1, 2023
0a5b040
feat: 가게 이름 검색 UI 추가
HAEROOL Nov 2, 2023
bf5fcf6
feat: 가게 검색 Toast UI 추가
HAEROOL Nov 2, 2023
e4d390d
style: Toast 스타일 추가
HAEROOL Nov 2, 2023
dda2b83
style: 상점 찾기 모달 스타일 수정
HAEROOL Nov 8, 2023
68b32f3
feat: 가게 검색 기능 중 클릭 시 검색 기능 추가
HAEROOL Nov 10, 2023
3e5fd54
style: 토스트 팝업 open 시 상점 스크롤 height 축소
HAEROOL Nov 10, 2023
85cfc68
feat: 상점 검색 검색 인풋 엔터 이벤트 추가
HAEROOL Nov 11, 2023
0f9c995
feat: 사장님 정보 입력 인풋 에러 핸들링 추가
HAEROOL Nov 13, 2023
9f1248d
feat: 회원가입 사장님 정보 input 에러 메시지 구현
HAEROOL Nov 27, 2023
f8667e0
Merge branch 'develop' into feature/add-signup-page
HAEROOL Nov 27, 2023
e03d101
Merge remote-tracking branch 'origin/feature/#27' into feature/add-si…
HAEROOL Nov 28, 2023
88b477e
refactor: store 이름 shop으로 통일
HAEROOL Nov 28, 2023
db5c11f
feat: 사업자 등록증 파일 업로드 로직 추가
HAEROOL Nov 29, 2023
878ce3a
feat: 사업자 등록증 파일 삭제 로직 추가
HAEROOL Nov 29, 2023
369930a
style: 사업자 등록증 업로드 div height, width 수정
HAEROOL Nov 29, 2023
99e5ccd
feat: 사업자 등록증 드래그앤드롭 파일 업로드 구현
HAEROOL Nov 29, 2023
411414a
Merge branch 'develop' into feature/add-signup-page
HAEROOL Nov 30, 2023
d0d44cb
style: Owner 데이터 입력 step height 삭제
HAEROOL Nov 30, 2023
d5a6d3d
feat: 업로드 파일 관리를 위한 useFileController 훅 추가
HAEROOL Nov 30, 2023
6442b90
feat: 상점검색 모달 회원가입 페이지와 연결
HAEROOL Dec 1, 2023
8c69e13
refactor: 사업자 등록증 input, 대표자 번호 input register 결합
HAEROOL Dec 1, 2023
63cf2b1
feat: 사업자 등록번호와 전화번호 autofocus 구현
HAEROOL Dec 1, 2023
c563bb2
feat: mobile 뷰 등록번호, 연락처 input register 추가
HAEROOL Dec 1, 2023
ea31d69
feat: 사장님 정보 입력 다음 버튼 활성화 로직 추가
HAEROOL Dec 5, 2023
c3acc22
fix: input 입력없이 next 버튼 눌러지는 버그 수정
HAEROOL Dec 5, 2023
235dc43
feat: 파일 업로드 api 추가
HAEROOL Dec 5, 2023
8c2bbe0
refactor: 회원가입 데이터 관리용 store생성
HAEROOL Dec 7, 2023
59e8252
fix: 파일 업로드 input 파일 데이터 전역으로 변경
HAEROOL Dec 8, 2023
8e7a927
feat: 회원가입 query 작성
HAEROOL Dec 8, 2023
6c874ee
feat: 회원가입 api 연동
HAEROOL Dec 13, 2023
e8a67de
styles: 모바일 다음 버튼 위치 조정
HAEROOL Dec 13, 2023
d9c5614
styles: 에러메시지 위치 수정
HAEROOL Dec 13, 2023
d9ff5dc
feat: 파일 3개 미만 첨부 시 에러 메시지 출력
HAEROOL Dec 13, 2023
9655817
refactor: 오타수정
HAEROOL Jan 2, 2024
5e33bd2
refactor: store와 shop 중 shop으로 변수명 통일
HAEROOL Jan 2, 2024
ae7ace0
refactor: CustomButton 사이즈 주석 추가
HAEROOL Jan 2, 2024
86786ad
refactor: calc() 값을 static한 값으로 변경
HAEROOL Jan 2, 2024
33d084d
refactor: setOwnerInfo 함수명 통일
HAEROOL Jan 2, 2024
a0af29a
refactor: useCheckNextStep 관련 함수명 step 제거
HAEROOL Jan 4, 2024
b8c7fb9
refactor: optional 타입 Partial로 대체
HAEROOL Jan 4, 2024
77f724c
refacotr: 업로드 api client multipartClient로 분리
HAEROOL Jan 4, 2024
63af64d
Merge branch 'develop' into feature/add-signup-page
HAEROOL Jan 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/api/register/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { client } from 'api';
import axios from 'axios';
import API_PATH from 'config/constants';

import {
AuthCodeParam, AuthCodeResponse, EmailRegisterParam, EmailRegisterResponse,
AuthCodeParam,
AuthCodeResponse,
EmailRegisterParam,
EmailRegisterResponse,
FilesResponse,
RegisterParam,
} from 'model/register';

export const getEmailDuplicate = async (param: string) => {
Expand All @@ -17,3 +25,21 @@ export const verificationAuthCode = async (param:AuthCodeParam) => {
const { data } = await client.post<AuthCodeResponse>('/owners/verification/code', param);
return AuthCodeResponse.parse(data);
};

export const registerUser = async (param:RegisterParam) => {
const { status } = await client.post('/owners/register', param);
return status;
};

export const getFileUrls = async (param:FormData, token:string) => {
const registerClient = axios.create({
baseURL: `${API_PATH}`,
timeout: 2000,
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'multipart/form-data',
},
});
const { data } = await registerClient.post('/owners/upload/files', param);
return FilesResponse.parse(data);
};
3 changes: 3 additions & 0 deletions src/assets/svg/auth/default-file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/svg/auth/search-glasses.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/component/common/CustomModal/CustomModal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 100%;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
background-color: #00000066;
Expand Down
15 changes: 14 additions & 1 deletion src/model/register/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,22 @@ export const AuthCodeResponse = z.object({
export type AuthCodeResponse = z.infer<typeof AuthCodeResponse>;

export const RegisterParam = z.object({
attachment_urls: z.array(z.object({
file_url: z.string(),
})),
company_number: z.string(),
shop_id: z.number().nullable(),
email: z.string(),
name: z.string(),
password: z.string(),
isAuthentication: z.boolean().refine((value) => value === true),
phone_number: z.string(),
shop_name: z.string(),
});

export type RegisterParam = z.infer<typeof RegisterParam>;

export const FilesResponse = z.object({
file_urls: z.array(z.string()),
});

export type FilesResponse = z.infer<typeof FilesResponse>;
1 change: 0 additions & 1 deletion src/page/Auth/Signup/SignUp.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

&__steps {
width: calc(100% + 2px);
height: 681px;
display: flex;
flex-direction: column;
justify-content: space-between;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,22 @@
background-color: #c4c4c4;
}
}

&--mobile-small {
width: 83px;
height: 37px;
font-weight: 500;
font-size: 15px;
background-color: #175c8e;
color: #ffffff;
border: none;

&:hover {
cursor: pointer;
}

&:disabled {
background-color: #c4c4c4;
}
}
}
3 changes: 2 additions & 1 deletion src/page/Auth/Signup/component/CustomButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import styles from './CustomButton.module.scss';

interface ButtonProps {
content:string,
buttonSize: 'small' | 'mobile' | 'large',
// 80px | 부모 요소의 절반 width | 부모요소 전체 width | 83px
buttonSize: 'small' | 'mobile' | 'large' | 'mobile-small',
disable?: boolean,
submit?:boolean
onClick?: () => void
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
.warn {
display: flex;
align-items: center;
margin-top: 9px;
padding-bottom: 16px;
gap: 7px;
height: 11px;
margin: 8px 0 0;

&--phrase {
display: block;
Expand Down
36 changes: 33 additions & 3 deletions src/page/Auth/Signup/component/UserEmail/UserEmail.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@
display: flex;
flex-direction: column;
margin-top: 8px;
margin-bottom: 16px;
gap: 8px;
}

.input {
width: calc(100% - 32px);
border: 1px solid #d2dae2;
height: calc(48px - 30px);
height: 18px;
padding: 14px 16px;

&::-webkit-inner-spin-button {
Expand All @@ -55,6 +53,34 @@
border-bottom: 1px solid #f7941e;
}
}

&--code {
width: calc(100% - 32px);
border: 1px solid #d2dae2;
height: calc(48px - 30px);
padding: 14px 16px;
margin-top: 8px;

&::-webkit-inner-spin-button {
appearance: none;
margin: 0;
}

@include media.media-breakpoint-down(mobile) {
width: 100%;
margin-top: 31px;
padding: 0;
padding-bottom: 8px;
font-size: 15px;
border: none;
border-bottom: 1px solid #d2dae2;
outline: none;

&:focus {
border-bottom: 1px solid #f7941e;
}
}
}
}

&__alert {
Expand Down Expand Up @@ -92,3 +118,7 @@
bottom: 0;
}
}

.button {
margin-top: 18px;
}
51 changes: 24 additions & 27 deletions src/page/Auth/Signup/component/UserEmail/index.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
import CustomButton from 'page/Auth/Signup/component/CustomButton';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import useValidateEmail from 'page/Auth/Signup/hooks/useValidateEmail';
import useAuthCheck from 'page/Auth/Signup/hooks/useAuthCheck';
import useVerification from 'page/Auth/Signup/hooks/useVerification';
import ErrorMessage from 'page/Auth/Signup/component/ErrorMessage';
import useRegisterInfo from 'store/registerStore';
import styles from './UserEmail.module.scss';

type ButtonClickEvent = {
goNext?: () => void;
userData: RegisterData,
setAuthenticate: (data:RegisterData) => void
};

export default function UserEmail({ userData, setAuthenticate }:ButtonClickEvent) {
export default function UserEmail() {
const { isMobile } = useMediaQuery();
const { userInfo: userData } = useRegisterInfo();
const {
emailHandleSubmit, errors: formErrors, emailDuplicateRegister, watch,
emailHandleSubmit, errors: formErrors, emailDuplicateRegister,
} = useValidateEmail();
const {
isOpen, onSubmit, errorMessage: requestError, email, refetch,
isOpen, onSubmit, email, refetch,
} = useAuthCheck(userData.email ? userData.email : '', isMobile);
const {
verificationCode,
codeInput, errorMessage: verificateError,
} = useVerification(email, setAuthenticate, userData);
} = useVerification(email);

return (
!isMobile
Expand All @@ -33,28 +28,30 @@ export default function UserEmail({ userData, setAuthenticate }:ButtonClickEvent
<span className={styles['email-check__label']}>이메일 인증</span>
<div className={styles['email-check__input']}>
<input className={styles.input} type="text" placeholder="이메일 입력@example.com" {...emailDuplicateRegister} disabled={isOpen} />
{isOpen && <input className={styles.input} type="text" pattern="\d*" maxLength={6} placeholder="인증번호" ref={codeInput} disabled={userData.isAuthentication} />}
{ formErrors.email && <ErrorMessage message={formErrors.email.message} />}
{isOpen && <input className={styles['input--code']} type="text" pattern="\d*" maxLength={6} placeholder="인증번호" ref={codeInput} disabled={userData.isAuthentication} />}
</div>
{ formErrors.email && <ErrorMessage message={formErrors.email.message} />}
{(!formErrors.email && requestError && email === watch().email)
&& <ErrorMessage message={requestError} />}
{ verificateError && <ErrorMessage message={verificateError} />}
{isOpen ? (
<>
<span className={styles['email-check__alert']}>* 제한시간 5 : 00</span>
{ verificateError ? <ErrorMessage message={verificateError} />
: <span className={styles['email-check__alert']}>* 제한시간 5 : 00</span>}
<div className={styles.button}>
<CustomButton
buttonSize="large"
content="인증완료"
onClick={verificationCode}
disable={userData.isAuthentication}
/>
</div>
</>
) : (
<div className={styles.button}>
<CustomButton
buttonSize="large"
content="인증완료"
onClick={verificationCode}
disable={userData.isAuthentication}
content="인증번호발송"
submit
/>
</>
) : (
<CustomButton
buttonSize="large"
content="인증번호발송"
submit
/>
</div>
)}
</form>
)
Expand Down
4 changes: 0 additions & 4 deletions src/page/Auth/Signup/component/UserId/UserId.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
color: #858585;
font-size: 11px;
margin-top: 9px;

// @include media.media-breakpoint-down(mobile) {
// margin: 0;
// }
}

&__warn {
Expand Down
10 changes: 2 additions & 8 deletions src/page/Auth/Signup/component/UserId/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import useMediaQuery from 'utils/hooks/useMediaQuery';
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 {
setId: (data:RegisterData) => void,
userData: RegisterData
}

export default function UserId({ setId, userData }:EmailInputProps) {
export default function UserId() {
const { isMobile } = useMediaQuery();
const {
emailHandleSubmit, errors: formErros, emailDuplicateRegister, watch,
} = useValidateEmail();
const {
status, onSubmit, onMobileSubmit, email, errorMessage: requestError,
} = useCheckEmailDuplicate(userData, setId, isMobile);
} = useCheckEmailDuplicate(isMobile);

return (
<form
Expand Down
13 changes: 5 additions & 8 deletions src/page/Auth/Signup/component/UserPassword/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ import { ReactComponent as ShowIcon } from 'assets/svg/auth/show.svg';
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';
import { User } from 'page/Auth/Signup/types/User';

import { SubmitHandler } from 'react-hook-form';
import ErrorMessage from 'page/Auth/Signup/component/ErrorMessage';
import useRegisterInfo from 'store/registerStore';
import styles from './UserPassword.module.scss';

interface PasswordInputProps {
setPassword: (data:RegisterData) => void,
userData?: RegisterData
}

export default function UserPassword({ setPassword, userData }:PasswordInputProps) {
export default function UserPassword() {
const { isMobile } = useMediaQuery();
const { userInfo: userData, setUserInfo: setPassword } = useRegisterInfo();
const { value: isBlind, changeValue: changeIsBlind } = useBooleanState(true);
const {
passwordRegister, passwordConfirmRegister, errors: formErrors, handleSubmit,
} = usePasswordConfirm();
const onSubmit:SubmitHandler<RegisterData> = (data) => {
const onSubmit:SubmitHandler<User> = (data) => {
setPassword({ ...userData, password: data.password });
};
return (
Expand Down
4 changes: 2 additions & 2 deletions src/page/Auth/Signup/hooks/useAuthCheck.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useGenerateAuthCode } from 'query/register';
import { useEffect, useState } from 'react';
import { SubmitHandler } from 'react-hook-form';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import { User } from 'page/Auth/Signup/types/User';

export default function useAuthCheck(userEmail:string, isMobile:boolean) {
const [email, setEmail] = useState('');
Expand All @@ -11,7 +11,7 @@ export default function useAuthCheck(userEmail:string, isMobile:boolean) {
status, refetch, isError, error,
} = useGenerateAuthCode(email);

const onSubmit:SubmitHandler<RegisterData> = (data) => {
const onSubmit:SubmitHandler<User> = (data) => {
setEmail(() => (data.email ? data.email : ''));
};

Expand Down
14 changes: 6 additions & 8 deletions src/page/Auth/Signup/hooks/useCheckEmailDuplicate.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import { useCheckDuplicate } from 'query/register';
import { useEffect, useState } from 'react';
import { SubmitHandler } from 'react-hook-form';
import { RegisterData } from 'page/Auth/Signup/types/RegisterData';
import { User } from 'page/Auth/Signup/types/User';
import useRegisterInfo from 'store/registerStore';

export default function useCheckEmailDuplicate(
userData:RegisterData,
setId: (data:RegisterData) => void,
isMobile: boolean,
) {
export default function useCheckEmailDuplicate(isMobile: boolean) {
const [email, setEmail] = useState<string>('');
const [errorMessage, setMessage] = useState('');
const { status, refetch, error } = useCheckDuplicate(email);
const { userInfo: userData, setUserInfo: setId } = useRegisterInfo();

const onSubmit:SubmitHandler<RegisterData> = (data) => {
const onSubmit:SubmitHandler<User> = (data) => {
setEmail(() => (data.email ? data.email : ''));
};
const onMobileSubmit:SubmitHandler<RegisterData> = (data) => {
const onMobileSubmit:SubmitHandler<User> = (data) => {
if (isMobile) {
onSubmit(data);
}
Expand Down
Loading
Loading