Skip to content

Commit c40d60d

Browse files
authored
feat: 회원가입시 성별, 생년월일 정보 기입란 삭제 (#147)
* feat: 회원가입시 성별, 생년월일 정보 기입란 삭제 * remove: 미사용 css 삭제
1 parent 3bb9f74 commit c40d60d

File tree

5 files changed

+18
-137
lines changed

5 files changed

+18
-137
lines changed

src/components/login/signup/SignupProfileScreen.tsx

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,12 @@ import BlockToggleBtn from "@/components/button/BlockToggleBtn";
66

77
import styles from "./signup.module.css";
88

9-
import { Gender, GenderEnum } from "@/types/auth";
10-
119
import { IconSignupProfileImage } from "@/public/svgs";
1210

1311
type SignupProfileScreenProps = {
1412
toNextStage: () => void;
1513
nickname: string;
1614
setNickname: Dispatch<SetStateAction<string>>;
17-
gender: Gender | "";
18-
setGender: Dispatch<SetStateAction<Gender | "">>;
19-
birth: string;
20-
setBirth: Dispatch<SetStateAction<string>>;
2115
defaultProfileImageUrl: string;
2216
profileImageFile: File | null;
2317
setProfileImageFile: Dispatch<SetStateAction<File | null>>;
@@ -27,10 +21,6 @@ const SignupProfileScreen = ({
2721
toNextStage,
2822
nickname,
2923
setNickname,
30-
gender,
31-
setGender,
32-
birth,
33-
setBirth,
3424
defaultProfileImageUrl,
3525
profileImageFile,
3626
setProfileImageFile,
@@ -43,14 +33,6 @@ const SignupProfileScreen = ({
4333
alert("닉네임을 입력해주세요.");
4434
return;
4535
}
46-
if (!birth) {
47-
alert("생년월일을 입력해주세요.");
48-
return;
49-
}
50-
if (gender === "") {
51-
alert("성별을 선택해주세요.");
52-
return;
53-
}
5436
toNextStage();
5537
};
5638

@@ -113,32 +95,10 @@ const SignupProfileScreen = ({
11395
onChange={(e) => setNickname(e.target.value)}
11496
/>
11597
</div>
116-
117-
<div className={styles.profile__birth}>
118-
<label htmlFor="birth">생년월일</label>
119-
<input
120-
id="birth"
121-
type="text"
122-
placeholder="생년월일 8자리를 입력해주세요. (예: 20010227)"
123-
value={birth}
124-
onChange={(e) => setBirth(e.target.value)}
125-
/>
126-
</div>
127-
128-
<div className={styles.profile__sex}>
129-
<label htmlFor="sex">성별</label>
130-
<select id="sex" value={gender} onChange={(e) => setGender(e.target.value as Gender)}>
131-
<option value="" disabled>
132-
성별을 선택해주세요.
133-
</option>
134-
<option value={GenderEnum.MALE}>남성</option>
135-
<option value={GenderEnum.FEMALE}>여성</option>
136-
<option value={GenderEnum.PREFER_NOT_TO_SAY}>선택 안 함</option>
137-
</select>
138-
</div>
13998
</div>
99+
140100
<div style={{ margin: "64px 10px 0 10px" }}>
141-
<BlockToggleBtn onClick={submit} isToggled={!!nickname && !!birth && !!gender}>
101+
<BlockToggleBtn onClick={submit} isToggled={!!nickname}>
142102
가입 완료
143103
</BlockToggleBtn>
144104
</div>

src/components/login/signup/SignupSurvey.tsx

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import SignupPrepareScreen from "./SignupPrepareScreen";
1212
import SignupProfileScreen from "./SignupProfileScreen";
1313
import SignupRegionScreen from "./SignupRegionScreen";
1414

15-
import { Gender, PreparationStatus, SignUpRequest } from "@/types/auth";
15+
import { PreparationStatus, SignUpRequest } from "@/types/auth";
1616
import { RegionKo } from "@/types/university";
1717

1818
type SignupSurveyProps = {
@@ -32,47 +32,15 @@ const SignupSurvey = ({ signUpToken, baseNickname, baseEmail, baseProfileImageUr
3232
const [countries, setCountries] = useState<string[]>([]);
3333

3434
const [nickname, setNickname] = useState<string>(baseNickname);
35-
const [gender, setGender] = useState<Gender | "">("");
36-
const [birth, setBirth] = useState<string>("");
3735
const [profileImageFile, setProfileImageFile] = useState<File | null>(null);
3836

39-
const convertBirth = (value: string): string => {
40-
if (value.length !== 8) {
41-
throw new Error("생년월일을 8자리로 입력해주세요.");
42-
}
43-
44-
const year = value.substring(0, 4);
45-
const month = value.substring(4, 6);
46-
const day = value.substring(6, 8);
47-
48-
const formattedDate = `${year}-${month}-${day}`;
49-
50-
const date = new Date(formattedDate);
51-
const isValidDate =
52-
date.getFullYear() === parseInt(year, 10) &&
53-
date.getMonth() + 1 === parseInt(month, 10) &&
54-
date.getDate() === parseInt(day, 10);
55-
56-
if (!isValidDate) {
57-
throw new Error("유효한 날짜가 아닙니다.");
58-
}
59-
60-
return formattedDate;
61-
};
62-
6337
const createRegisterRequest = async (): Promise<SignUpRequest> => {
6438
const submitRegion: RegionKo[] = region === "아직 잘 모르겠어요" ? [] : [region as RegionKo];
6539

6640
if (!curPreparation) {
6741
throw new Error("준비 단계를 선택해주세요");
6842
}
6943

70-
if (gender === "") {
71-
throw new Error("성별을 선택해주세요");
72-
}
73-
74-
const convertedBirth: string = convertBirth(birth);
75-
7644
let imageUrl: string | null = baseProfileImageUrl;
7745

7846
if (profileImageFile) {
@@ -92,8 +60,6 @@ const SignupSurvey = ({ signUpToken, baseNickname, baseEmail, baseProfileImageUr
9260
preparationStatus: curPreparation,
9361
nickname,
9462
profileImageUrl: imageUrl,
95-
gender,
96-
birth: convertedBirth,
9763
};
9864
};
9965

@@ -155,10 +121,6 @@ const SignupSurvey = ({ signUpToken, baseNickname, baseEmail, baseProfileImageUr
155121
toNextStage={submitRegisterRequest}
156122
nickname={nickname}
157123
setNickname={setNickname}
158-
gender={gender}
159-
setGender={setGender}
160-
birth={birth}
161-
setBirth={setBirth}
162124
defaultProfileImageUrl={baseProfileImageUrl}
163125
profileImageFile={profileImageFile}
164126
setProfileImageFile={setProfileImageFile}

src/components/login/signup/signup.module.css

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -218,49 +218,3 @@
218218
letter-spacing: -0.35px;
219219
text-transform: uppercase;
220220
}
221-
222-
.profile__birth {
223-
margin: 32px 10px 0 10px;
224-
}
225-
226-
.profile__birth > input {
227-
width: 100%;
228-
height: 50px;
229-
padding: 0px 16px;
230-
box-sizing: border-box;
231-
border: 2px solid #c3dbff;
232-
border-radius: 8px;
233-
background: #fff;
234-
235-
color: #a8a8a8;
236-
font-family: Pretendard;
237-
font-size: 14px;
238-
font-style: normal;
239-
font-weight: 400;
240-
line-height: 150%; /* 21px */
241-
letter-spacing: -0.35px;
242-
text-transform: uppercase;
243-
}
244-
245-
.profile__sex {
246-
margin: 32px 10px 0 10px;
247-
}
248-
249-
.profile__sex > select {
250-
width: 100%;
251-
height: 50px;
252-
padding: 0px 16px;
253-
box-sizing: border-box;
254-
border: 2px solid #c3dbff;
255-
border-radius: 8px;
256-
background: #fff;
257-
258-
color: #a8a8a8;
259-
font-family: Pretendard;
260-
font-size: 14px;
261-
font-style: normal;
262-
font-weight: 400;
263-
line-height: 150%; /* 21px */
264-
letter-spacing: -0.35px;
265-
text-transform: uppercase;
266-
}

src/services/auth.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ export const emailAuthApi = (email: string, password: string): Promise<AxiosResp
3232
export const emailSignUpApi = (signUpRequest: EmailSignUpRequest): Promise<AxiosResponse<EmailSignUpResponse>> =>
3333
publicAxiosInstance.post("/auth/email/sign-up", signUpRequest);
3434

35-
export const signUpApi = (signUpRequest: SignUpRequest): Promise<AxiosResponse<SignUpResponse>> =>
36-
publicAxiosInstance.post("/auth/sign-up", signUpRequest);
35+
export const signUpApi = (signUpRequest: SignUpRequest): Promise<AxiosResponse<SignUpResponse>> => {
36+
// 임시 성별, 생년월일 추가. API 변경 시 삭제
37+
signUpRequest["birth"] = "2000-01-01";
38+
signUpRequest["gender"] = "PREFER_NOT_TO_SAY";
39+
40+
return publicAxiosInstance.post("/auth/sign-up", signUpRequest);
41+
};
3742

3843
export const signOutApi = (): Promise<AxiosResponse<null>> => axiosInstance.post("/auth/sign-out");
3944

src/types/auth.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { Country, RegionKo } from "./university";
22

33
export type PreparationStatus = "CONSIDERING" | "PREPARING_FOR_DEPARTURE" | "STUDYING_ABROAD";
44

5-
export type Gender = "MALE" | "FEMALE" | "PREFER_NOT_TO_SAY";
5+
// export type Gender = "MALE" | "FEMALE" | "PREFER_NOT_TO_SAY";
66

77
// eslint-disable-next-line no-shadow
8-
export enum GenderEnum {
9-
MALE = "MALE",
10-
FEMALE = "FEMALE",
11-
PREFER_NOT_TO_SAY = "PREFER_NOT_TO_SAY",
12-
}
8+
// export enum GenderEnum {
9+
// MALE = "MALE",
10+
// FEMALE = "FEMALE",
11+
// PREFER_NOT_TO_SAY = "PREFER_NOT_TO_SAY",
12+
// }
1313

1414
// Email
1515
export interface EmailSignUpRequest {
@@ -71,8 +71,8 @@ export interface SignUpRequest {
7171
preparationStatus: PreparationStatus; // 준비 단계
7272
nickname: string; // 닉네임
7373
profileImageUrl: string; // 프로필 이미지
74-
gender: Gender; // 성별
75-
birth: string; // 생년월일 yyyy-mm-dd
74+
// gender: Gender; // 성별
75+
// birth: string; // 생년월일 yyyy-mm-dd
7676
}
7777

7878
export interface SignUpResponse {

0 commit comments

Comments
 (0)