diff --git a/src/apis/auth/dto.ts b/src/apis/auth/dto.ts index 969a3b91..e0490291 100644 --- a/src/apis/auth/dto.ts +++ b/src/apis/auth/dto.ts @@ -1,14 +1,15 @@ -import { BaseSuccessResponse } from '../core/dto'; +import type { BaseSuccessResponse } from '@apis/core/dto'; // jwt를 이용한 사용자 정보 조회 응답 export type getUserInfoByJwtResponse = BaseSuccessResponse; // jwt를 이용한 사용자 정보 조회 응답 데이터 export interface getUserInfoByJwtData { - userId: number; + id: number; name: string; phoneNumber: string; email: string; nickname: string; profilePictureUrl: string; bio: string; + birthDate: string; } 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'); 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 00b20c4c..0cc1d5ff 100644 --- a/src/apis/user/dto.ts +++ b/src/apis/user/dto.ts @@ -1,15 +1,15 @@ -import { BaseSuccessResponse } from '../core/dto'; +import type { BaseSuccessResponse } from '@apis/core/dto'; // 사용자 정보 공통 인터페이스 export interface UserInfoData { - userId: number; + id: number; name: string; phoneNumber: string; email: string; 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..40c61b9e 100644 --- a/src/apis/user/index.ts +++ b/src/apis/user/index.ts @@ -1,6 +1,11 @@ -import { GetUserInfoResponse, PatchUserInfoRequest, PatchUserInfoResponse, PatchUserWithDrawResponse } from './dto'; -import { newRequest } from '../core'; -import { EmptySuccessResponse } from '../core/dto'; +import { newRequest } from '@apis/core'; +import type { EmptySuccessResponse } from '@apis/core/dto'; +import type { + GetUserInfoResponse, + PatchUserInfoRequest, + PatchUserInfoResponse, + PatchUserWithDrawResponse, +} from './dto'; // 유저 정보 수정 api export const patchUserInfoApi = (data: Partial, userId: number) => 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'); 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,