Skip to content

Commit

Permalink
Merge pull request #71 from BCSDLab/feature/#70
Browse files Browse the repository at this point in the history
[Auth] 회원가입 API 변경사항 대응
  • Loading branch information
ChoiWonBeen authored Jan 17, 2024
2 parents 12817ce + 7189403 commit 2a32c76
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/api/auth/APIDetail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ implements APIRequest<R> {
export class Signup<R extends SignupResponse> implements APIRequest<R> {
method = HTTP_METHOD.POST;

path = '/user/register';
path = '/user/student/register';

response!: R;

Expand Down
3 changes: 1 addition & 2 deletions src/api/auth/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@ export interface SignupRequest {
// options
name?: string;
nickname?: string;
gender?: string;
gender?: number;
major?: string;
student_number?: string;
phone_number?: string;
identity?: number;
is_graduated?: boolean;
}

Expand Down
7 changes: 5 additions & 2 deletions src/pages/Auth/SignupPage/hooks/useSignup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { auth } from 'api';
import { AxiosError } from 'axios';
import { useMutation } from 'react-query';
import showToast from 'utils/ts/showToast';

Expand All @@ -13,8 +14,10 @@ const useSignup = (options: ISignupOption) => {
options.onSuccess?.();
showToast('success', '아우누리 이메일로 인증 메일을 발송했습니다. 확인 부탁드립니다.');
},
onError: () => {
showToast('error', '서버에 오류가 발생했습니다.');
onError: (error: AxiosError<{ message?: string }>) => {
if (error?.response?.data) {
showToast('error', error.response.data.message || '에러가 발생했습니다.');
}
},
});

Expand Down
5 changes: 2 additions & 3 deletions src/pages/Auth/SignupPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ const GenderListbox = React.forwardRef<ICustomFormInput, ICustomFormInputProps>(
[styles['select__trigger--active']]: currentValue !== null,
})}
>
{currentValue !== null ? GENDER_TYPE[currentValue].value : '성별'}
{currentValue !== null ? GENDER_TYPE[currentValue].label : '성별'}
</button>
{isOpenedPopup && (
<ul className={styles.select__content} role="listbox">
Expand Down Expand Up @@ -447,7 +447,7 @@ const useSignupForm = () => {
const submitForm: ISubmitForm = (formValue) => {
const payload = {
// 필수정보
email: formValue.id?.trim(),
email: `${formValue.id?.trim()}@koreatech.ac.kr`,
password: formValue.password,
// 옵션
name: formValue.name || undefined,
Expand All @@ -456,7 +456,6 @@ const useSignupForm = () => {
major: formValue['student-number'].major || undefined,
student_number: formValue['student-number'].studentNumber || undefined,
phone_number: formValue['phone-number'] || undefined,
identity: 0,
is_graduated: false,
};
mutate(payload);
Expand Down

0 comments on commit 2a32c76

Please sign in to comment.