From 0b3815d027f73e7a96e068a4863b526d8bb533d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=80=EB=AF=BC=EC=9E=AC?= Date: Mon, 23 Dec 2024 10:20:21 +0900 Subject: [PATCH 1/9] =?UTF-8?q?Refact:=20user=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=EC=9D=98=20api=20=ED=8C=8C=EC=9D=BC=EC=97=90=EC=84=9C?= =?UTF-8?q?=EC=9D=98=20=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/user/dto.ts | 6 +++--- src/apis/user/index.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apis/user/dto.ts b/src/apis/user/dto.ts index 00b20c4c..ea6513c5 100644 --- a/src/apis/user/dto.ts +++ b/src/apis/user/dto.ts @@ -1,4 +1,4 @@ -import { BaseSuccessResponse } from '../core/dto'; +import { BaseSuccessResponse } from '@apis/core/dto'; // 사용자 정보 공통 인터페이스 export interface UserInfoData { @@ -9,7 +9,7 @@ export interface UserInfoData { nickname: string; profilePictureUrl: string; bio: string; - birthDate: string; // user 공통 인터페이스에 이 두 개는 안 나와있어서 일단 이것들만 optional 처리했습니다... + birthDate: string; isFriend: boolean; } @@ -37,5 +37,5 @@ export type PatchUserWithDrawResponse = BaseSuccessResponse; // 탈퇴 성공 시 항상 빈 객체가 응답으로 온다면 Record으로 타입 안정성 높일 수 있답니다 + data: Record; // 탈퇴 성공 시 항상 빈 객체가 응답으로 온다면 Record으로 타입 안정성 높일 수 있음 } diff --git a/src/apis/user/index.ts b/src/apis/user/index.ts index 1cd45b08..79875b10 100644 --- a/src/apis/user/index.ts +++ b/src/apis/user/index.ts @@ -1,6 +1,6 @@ +import { newRequest } from '@apis/core'; +import { EmptySuccessResponse } from '@apis/core/dto'; import { GetUserInfoResponse, PatchUserInfoRequest, PatchUserInfoResponse, PatchUserWithDrawResponse } from './dto'; -import { newRequest } from '../core'; -import { EmptySuccessResponse } from '../core/dto'; // 유저 정보 수정 api export const patchUserInfoApi = (data: Partial, userId: number) => From 30d93f28268fe849437175077d65cc215181ec18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=80=EB=AF=BC=EC=9E=AC?= Date: Mon, 23 Dec 2024 10:24:22 +0900 Subject: [PATCH 2/9] =?UTF-8?q?Chore:=20=EC=98=A4=ED=83=80=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/user/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/apis/user/index.ts b/src/apis/user/index.ts index 79875b10..f65473d9 100644 --- a/src/apis/user/index.ts +++ b/src/apis/user/index.ts @@ -1,6 +1,11 @@ import { newRequest } from '@apis/core'; import { EmptySuccessResponse } from '@apis/core/dto'; -import { GetUserInfoResponse, PatchUserInfoRequest, PatchUserInfoResponse, PatchUserWithDrawResponse } from './dto'; +import type { + GetUserInfoResponse, + PatchUserInfoRequest, + PatchUserInfoResponse, + PatchUserWithDrawResponse, +} from './dto'; // 유저 정보 수정 api export const patchUserInfoApi = (data: Partial, userId: number) => From 3d2bcc763c9a5aeaf633b07445b92644ce203b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=80=EB=AF=BC=EC=9E=AC?= Date: Thu, 26 Dec 2024 14:10:24 +0900 Subject: [PATCH 3/9] =?UTF-8?q?Refact:=20jwt=20=EC=9D=B4=EC=9A=A9=ED=95=9C?= =?UTF-8?q?=20=ED=9A=8C=EC=9B=90=EC=A0=95=EB=B3=B4=20=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/auth/dto.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/apis/auth/dto.ts b/src/apis/auth/dto.ts index 969a3b91..7beeb9a7 100644 --- a/src/apis/auth/dto.ts +++ b/src/apis/auth/dto.ts @@ -11,4 +11,5 @@ export interface getUserInfoByJwtData { nickname: string; profilePictureUrl: string; bio: string; + birthDate: string; } From 2de288a6242a1c25933d1eb55a3a0758d1432830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=80=EB=AF=BC=EC=9E=AC?= Date: Thu, 26 Dec 2024 14:22:43 +0900 Subject: [PATCH 4/9] =?UTF-8?q?Chore:=20=EC=9D=B4=EC=9A=A9=EC=95=BD?= =?UTF-8?q?=EA=B4=80=20=EB=8F=99=EC=9D=98=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EB=9D=BC=EC=9A=B0=ED=8C=85=20=EA=B2=BD=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 140061b0..96beb78e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -57,9 +57,10 @@ const protectedRoutes = [ // 인증이 필요 없는 페이지 배열 const publicRoutes = [ { path: '/login', element: }, - { path: '/signup', element: }, { path: '/login/complete', element: }, - { path: '/terms-agreement', element: }, + + { path: '/signup', element: }, + { path: '/signup/terms-agreement', element: }, ]; const App: React.FC = () => { From d35e6f1af325cb58c64f6f3d30c0276da241b80b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=80=EB=AF=BC=EC=9E=AC?= Date: Fri, 27 Dec 2024 11:13:10 +0900 Subject: [PATCH 5/9] =?UTF-8?q?Chore:=20=EC=B6=A9=EB=8F=8C=20=EB=B0=A9?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EA=B2=BD=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 96beb78e..140061b0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -57,10 +57,9 @@ const protectedRoutes = [ // 인증이 필요 없는 페이지 배열 const publicRoutes = [ { path: '/login', element: }, - { path: '/login/complete', element: }, - { path: '/signup', element: }, - { path: '/signup/terms-agreement', element: }, + { path: '/login/complete', element: }, + { path: '/terms-agreement', element: }, ]; const App: React.FC = () => { From bac6d197d24c373efd5270a2fb6ffc776b58eda2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=80=EB=AF=BC=EC=9E=AC?= Date: Sat, 28 Dec 2024 16:24:26 +0900 Subject: [PATCH 6/9] =?UTF-8?q?Refact:=20user,=20auth=20=EB=8F=84=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20api=20=EC=9D=91=EB=8B=B5=20=EA=B8=B0=EB=B0=98?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20dto=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/auth/dto.ts | 2 +- src/apis/user/dto.ts | 2 +- src/pages/Login/LoginComplete/index.tsx | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/apis/auth/dto.ts b/src/apis/auth/dto.ts index 7beeb9a7..cef96a2b 100644 --- a/src/apis/auth/dto.ts +++ b/src/apis/auth/dto.ts @@ -4,7 +4,7 @@ import { BaseSuccessResponse } from '../core/dto'; export type getUserInfoByJwtResponse = BaseSuccessResponse; // jwt를 이용한 사용자 정보 조회 응답 데이터 export interface getUserInfoByJwtData { - userId: number; + id: number; name: string; phoneNumber: string; email: string; diff --git a/src/apis/user/dto.ts b/src/apis/user/dto.ts index ea6513c5..30d77eab 100644 --- a/src/apis/user/dto.ts +++ b/src/apis/user/dto.ts @@ -2,7 +2,7 @@ import { BaseSuccessResponse } from '@apis/core/dto'; // 사용자 정보 공통 인터페이스 export interface UserInfoData { - userId: number; + id: number; name: string; phoneNumber: string; email: string; diff --git a/src/pages/Login/LoginComplete/index.tsx b/src/pages/Login/LoginComplete/index.tsx index f7132bed..29654561 100644 --- a/src/pages/Login/LoginComplete/index.tsx +++ b/src/pages/Login/LoginComplete/index.tsx @@ -43,13 +43,13 @@ const LoginComplete: React.FC = () => { const response = await getUserInfoByJwtApi(); console.log(response); - const { nickname, name, userId } = response.data; - localStorage.setItem('current_user_id', `${userId}`); + const { nickname, name, id } = response.data; + localStorage.setItem('current_user_id', `${id}`); if (nickname && name) { if (nickname && name) { - const isAgreed = await hasAgreedToTerms(userId); - navigate(isAgreed ? '/' : '/terms-agreement'); // 이용 약관이 필요하면 (false) 해당 페이지로 이동 + const isAgreed = await hasAgreedToTerms(id); + navigate(isAgreed ? '/' : '/signup/terms-agreement'); // 이용 약관이 필요하면 (false) 해당 페이지로 이동 } } else { navigate('/signup'); From f52d572a6ba117cc9806cefd9b01327c4032d4f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=80=EB=AF=BC=EC=9E=AC?= Date: Sat, 28 Dec 2024 16:25:53 +0900 Subject: [PATCH 7/9] =?UTF-8?q?Fix:=20=EB=B9=8C=EB=93=9C=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recoil/ProfileViewer/userDetailsAtom.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/recoil/ProfileViewer/userDetailsAtom.ts b/src/recoil/ProfileViewer/userDetailsAtom.ts index 85a3a7e6..fe018ecb 100644 --- a/src/recoil/ProfileViewer/userDetailsAtom.ts +++ b/src/recoil/ProfileViewer/userDetailsAtom.ts @@ -2,12 +2,12 @@ import { atom } from 'recoil'; import type { UserInfoData } from '@apis/user/dto'; import imageBasic from '@assets/default/defaultProfile.svg'; -type BasicUserInfo = Pick; +type BasicUserInfo = Pick; export const UserInfoAtom = atom({ key: 'UserInfoAtom', default: { - userId: -1, + id: -1, nickname: '알 수 없음', bio: '', isFriend: false, From 90705a8d5f4294c55bcf1f302e054b4d533482fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=80=EB=AF=BC=EC=9E=AC?= Date: Sat, 28 Dec 2024 17:06:41 +0900 Subject: [PATCH 8/9] =?UTF-8?q?Chore:=20dto=20=ED=8C=8C=EC=9D=BC=20import?= =?UTF-8?q?=20=EC=8B=9C=20type=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/auth/dto.ts | 2 +- src/apis/auth/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/apis/auth/dto.ts b/src/apis/auth/dto.ts index cef96a2b..7cbd218c 100644 --- a/src/apis/auth/dto.ts +++ b/src/apis/auth/dto.ts @@ -1,4 +1,4 @@ -import { BaseSuccessResponse } from '../core/dto'; +import { BaseSuccessResponse } from '@apis/core/dto'; // jwt를 이용한 사용자 정보 조회 응답 export type getUserInfoByJwtResponse = BaseSuccessResponse; diff --git a/src/apis/auth/index.ts b/src/apis/auth/index.ts index fea044da..dec241ca 100644 --- a/src/apis/auth/index.ts +++ b/src/apis/auth/index.ts @@ -1,5 +1,5 @@ -import { getUserInfoByJwtResponse } from './dto'; -import { newRequest } from '../core'; +import { newRequest } from '@apis/core'; +import type { getUserInfoByJwtResponse } from './dto'; // jwt로 사용자 정보 조회 api /auth/me export const getUserInfoByJwtApi = () => newRequest.get('/auth/me'); From b50b609b2fce68c74102a56180f4ff26169c40c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A7=80=EB=AF=BC=EC=9E=AC?= Date: Sat, 28 Dec 2024 18:15:03 +0900 Subject: [PATCH 9/9] =?UTF-8?q?Chore:=20type=20=ED=82=A4=EC=9B=8C=EB=93=9C?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/auth/dto.ts | 2 +- src/apis/user-block/index.ts | 2 +- src/apis/user-report/index.ts | 2 +- src/apis/user/dto.ts | 2 +- src/apis/user/index.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apis/auth/dto.ts b/src/apis/auth/dto.ts index 7cbd218c..e0490291 100644 --- a/src/apis/auth/dto.ts +++ b/src/apis/auth/dto.ts @@ -1,4 +1,4 @@ -import { BaseSuccessResponse } from '@apis/core/dto'; +import type { BaseSuccessResponse } from '@apis/core/dto'; // jwt를 이용한 사용자 정보 조회 응답 export type getUserInfoByJwtResponse = BaseSuccessResponse; diff --git a/src/apis/user-block/index.ts b/src/apis/user-block/index.ts index ff97f4b7..2faee8a2 100644 --- a/src/apis/user-block/index.ts +++ b/src/apis/user-block/index.ts @@ -1,5 +1,5 @@ -import { EmptySuccessResponse } from '@apis/core/dto'; import { newRequest } from '@apis/core'; +import type { EmptySuccessResponse } from '@apis/core/dto'; import type { PostUserBlockRequest } from './dto'; // 유저 차단 api diff --git a/src/apis/user-report/index.ts b/src/apis/user-report/index.ts index 20155d76..207f70a1 100644 --- a/src/apis/user-report/index.ts +++ b/src/apis/user-report/index.ts @@ -1,5 +1,5 @@ -import { EmptySuccessResponse } from '@apis/core/dto'; import { newRequest } from '@apis/core'; +import type { EmptySuccessResponse } from '@apis/core/dto'; import type { PostUserReportRequest } from './dto'; // 유저 신고 api diff --git a/src/apis/user/dto.ts b/src/apis/user/dto.ts index 30d77eab..0cc1d5ff 100644 --- a/src/apis/user/dto.ts +++ b/src/apis/user/dto.ts @@ -1,4 +1,4 @@ -import { BaseSuccessResponse } from '@apis/core/dto'; +import type { BaseSuccessResponse } from '@apis/core/dto'; // 사용자 정보 공통 인터페이스 export interface UserInfoData { diff --git a/src/apis/user/index.ts b/src/apis/user/index.ts index f65473d9..40c61b9e 100644 --- a/src/apis/user/index.ts +++ b/src/apis/user/index.ts @@ -1,5 +1,5 @@ import { newRequest } from '@apis/core'; -import { EmptySuccessResponse } from '@apis/core/dto'; +import type { EmptySuccessResponse } from '@apis/core/dto'; import type { GetUserInfoResponse, PatchUserInfoRequest,