From cb5697d1721331bfe7a018b89f18df44b7826481 Mon Sep 17 00:00:00 2001 From: suwonthugger <127329855+suwonthugger@users.noreply.github.com> Date: Sun, 10 Nov 2024 18:33:37 +0900 Subject: [PATCH] =?UTF-8?q?[Common]=20[Feat]=20=EA=B1=B4=EB=84=88=EB=9B=B0?= =?UTF-8?q?=EA=B8=B0=20=EB=88=84=EB=9D=BD=EB=90=9C=20=EB=A1=9C=EC=A7=81=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 --- .../_components/authRegion/authRegion.tsx | 25 +++++++++++++++++-- .../_components/authSchool/authSchool.tsx | 7 +++++- .../src/shared/apis/auth/types/index.ts | 4 +-- .../_components/authRegion/authRegion.tsx | 20 ++++++++++++++- .../_components/authSchool/authSchool.tsx | 7 +++++- apps/web/src/shared/apis/auth/types/index.ts | 4 +-- 6 files changed, 58 insertions(+), 9 deletions(-) diff --git a/apps/mobile/src/app/auth/_components/authRegion/authRegion.tsx b/apps/mobile/src/app/auth/_components/authRegion/authRegion.tsx index f25a9a7..f0a97ca 100644 --- a/apps/mobile/src/app/auth/_components/authRegion/authRegion.tsx +++ b/apps/mobile/src/app/auth/_components/authRegion/authRegion.tsx @@ -42,7 +42,28 @@ const AuthRegion = ({ handleNextStep, 대학교 }: AuthRegionProps) => { const handle회원가입 = () => { mutate( - { univName: 대학교, region: 지역검색키워드 }, + { + univName: 대학교.length === 0 ? null : 대학교, + region: 지역검색키워드.length === 0 ? null : 지역검색키워드, + }, + { + onSuccess: () => { + handleNextStep('completion'); + }, + onError: (error) => { + alert('회원가입에 실패했습니다. 다시 시도해주세요.'); + console.error(error); + }, + }, + ); + }; + + const handle건너뛰기 = () => { + mutate( + { + univName: 대학교.length === 0 ? null : 대학교, + region: null, + }, { onSuccess: () => { handleNextStep('completion'); @@ -110,7 +131,7 @@ const AuthRegion = ({ handleNextStep, 대학교 }: AuthRegionProps) => { cancelText="취소" confirmText="확인" triggerText="건너뛰기" - onConfirm={() => handleNextStep('completion')} + onConfirm={handle건너뛰기} /> diff --git a/apps/mobile/src/app/auth/_components/authSchool/authSchool.tsx b/apps/mobile/src/app/auth/_components/authSchool/authSchool.tsx index 5844d87..39ff4f3 100644 --- a/apps/mobile/src/app/auth/_components/authSchool/authSchool.tsx +++ b/apps/mobile/src/app/auth/_components/authSchool/authSchool.tsx @@ -100,6 +100,11 @@ const AuthSchool = ({ handleNextStep, handle대학교변경 }: AuthSchoolProps) ); }; + const handle건너뛰기 = () => { + handleNextStep('region'); + handle대학교변경(''); + }; + return (
@@ -179,7 +184,7 @@ const AuthSchool = ({ handleNextStep, handle대학교변경 }: AuthSchoolProps) cancelText="취소" confirmText="확인" triggerText="건너뛰기" - onConfirm={() => handleNextStep('region')} + onConfirm={handle건너뛰기} />
diff --git a/apps/mobile/src/shared/apis/auth/types/index.ts b/apps/mobile/src/shared/apis/auth/types/index.ts index 2cb31a7..8217acc 100644 --- a/apps/mobile/src/shared/apis/auth/types/index.ts +++ b/apps/mobile/src/shared/apis/auth/types/index.ts @@ -15,8 +15,8 @@ export namespace PostUnivValidate { export namespace PostAuthJoin { export interface Params { - univName: string; - region: string; + univName: string | null; + region: string | null; } } diff --git a/apps/web/src/app/auth/_components/authRegion/authRegion.tsx b/apps/web/src/app/auth/_components/authRegion/authRegion.tsx index 041d6ed..d018e79 100644 --- a/apps/web/src/app/auth/_components/authRegion/authRegion.tsx +++ b/apps/web/src/app/auth/_components/authRegion/authRegion.tsx @@ -56,6 +56,24 @@ const AuthRegion = ({ handleNextStep, 대학교 }: AuthRegionProps) => { ); }; + const handle건너뛰기 = () => { + mutate( + { + univName: 대학교.length === 0 ? null : 대학교, + region: null, + }, + { + onSuccess: () => { + handleNextStep('completion'); + }, + onError: (error) => { + alert('회원가입에 실패했습니다. 다시 시도해주세요.'); + console.error(error); + }, + }, + ); + }; + return (
@@ -115,7 +133,7 @@ const AuthRegion = ({ handleNextStep, 대학교 }: AuthRegionProps) => { cancelText="취소" confirmText="확인" triggerText="건너뛰기" - onConfirm={() => {}} + onConfirm={handle건너뛰기} />
diff --git a/apps/web/src/app/auth/_components/authSchool/authSchool.tsx b/apps/web/src/app/auth/_components/authSchool/authSchool.tsx index 66c3672..52a478e 100644 --- a/apps/web/src/app/auth/_components/authSchool/authSchool.tsx +++ b/apps/web/src/app/auth/_components/authSchool/authSchool.tsx @@ -99,6 +99,11 @@ const AuthSchool = ({ handleNextStep, handle대학교변경 }: AuthSchoolProps) ); }; + const handle건너뛰기 = () => { + handleNextStep('region'); + handle대학교변경(''); + }; + return (
@@ -175,7 +180,7 @@ const AuthSchool = ({ handleNextStep, handle대학교변경 }: AuthSchoolProps) cancelText="취소" confirmText="확인" triggerText="건너뛰기" - onConfirm={() => {}} + onConfirm={handle건너뛰기} />
diff --git a/apps/web/src/shared/apis/auth/types/index.ts b/apps/web/src/shared/apis/auth/types/index.ts index 2cb31a7..8217acc 100644 --- a/apps/web/src/shared/apis/auth/types/index.ts +++ b/apps/web/src/shared/apis/auth/types/index.ts @@ -15,8 +15,8 @@ export namespace PostUnivValidate { export namespace PostAuthJoin { export interface Params { - univName: string; - region: string; + univName: string | null; + region: string | null; } }