|
@@ -4,26 +4,30 @@ import { ChangeEmailRequest, ChangeNameRequest, ChangeApproveRequest, ChangeSumm
|
|
|
import { MemberResponse } from '@/dtos/response/account/member';
|
|
import { MemberResponse } from '@/dtos/response/account/member';
|
|
|
import { ResultDto } from '@/dtos/response/common';
|
|
import { ResultDto } from '@/dtos/response/common';
|
|
|
import { fetchJson } from '@/lib/utils/server';
|
|
import { fetchJson } from '@/lib/utils/server';
|
|
|
-import { LoginLogType } from '@/constants/common';
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// 회원정보 조회
|
|
// 회원정보 조회
|
|
|
export async function fetchMemberInfo(): Promise<ResultDto<MemberResponse>> {
|
|
export async function fetchMemberInfo(): Promise<ResultDto<MemberResponse>> {
|
|
|
- return await fetchJson<MemberResponse>('/api/account/info', {
|
|
|
|
|
|
|
+ return await fetchJson<MemberResponse>('/api/auth/profile', {
|
|
|
method: 'GET'
|
|
method: 'GET'
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 이메일 변경 인증 메일 발송
|
|
// 이메일 변경 인증 메일 발송
|
|
|
export async function fetchChangeEmail(params: ChangeEmailRequest) {
|
|
export async function fetchChangeEmail(params: ChangeEmailRequest) {
|
|
|
- return await fetchJson('/api/account/change-email', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/email', {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
- data: params
|
|
|
|
|
|
|
+ headers: {
|
|
|
|
|
+ 'Accept': 'application/json',
|
|
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
|
|
+ },
|
|
|
|
|
+ body: JSON.stringify(params)
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 이메일 변경 인증 확인
|
|
// 이메일 변경 인증 확인
|
|
|
export async function fetchValidEmail(token: string) {
|
|
export async function fetchValidEmail(token: string) {
|
|
|
- return await fetchJson(`/api/auth/valid-email?token=${token}`, {
|
|
|
|
|
|
|
+ return await fetchJson(`/api/mypage/email/verify?token=${token}`, {
|
|
|
method: 'GET',
|
|
method: 'GET',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json'
|
|
'Accept': 'application/json'
|
|
@@ -33,7 +37,7 @@ export async function fetchValidEmail(token: string) {
|
|
|
|
|
|
|
|
// 별명 변경
|
|
// 별명 변경
|
|
|
export async function fetchChangeName(params: ChangeNameRequest) {
|
|
export async function fetchChangeName(params: ChangeNameRequest) {
|
|
|
- return await fetchJson('/api/account/change-name', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/name', {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json',
|
|
'Accept': 'application/json',
|
|
@@ -45,7 +49,7 @@ export async function fetchChangeName(params: ChangeNameRequest) {
|
|
|
|
|
|
|
|
// 별명 삭제
|
|
// 별명 삭제
|
|
|
export async function fetchRemoveName() {
|
|
export async function fetchRemoveName() {
|
|
|
- return await fetchJson('/api/account/remove-name', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/name', {
|
|
|
method: 'DELETE',
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json',
|
|
'Accept': 'application/json',
|
|
@@ -54,30 +58,33 @@ export async function fetchRemoveName() {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// 수신 설정
|
|
// 수신 설정
|
|
|
export async function fetchChangeApprove(params: ChangeApproveRequest) {
|
|
export async function fetchChangeApprove(params: ChangeApproveRequest) {
|
|
|
- return await fetchJson('/api/account/change-approve', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/receive-settings', {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
|
|
+ headers: {
|
|
|
|
|
+ 'Accept': 'application/json',
|
|
|
|
|
+ 'Content-Type': 'application/json'
|
|
|
|
|
+ },
|
|
|
body: JSON.stringify(params)
|
|
body: JSON.stringify(params)
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 한마디 변경
|
|
// 한마디 변경
|
|
|
export async function fetchChangeSummary(params: ChangeSummaryRequest) {
|
|
export async function fetchChangeSummary(params: ChangeSummaryRequest) {
|
|
|
- return await fetchJson('/api/account/change-summary', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/summary', {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json',
|
|
'Accept': 'application/json',
|
|
|
'Content-Type': 'application/json'
|
|
'Content-Type': 'application/json'
|
|
|
},
|
|
},
|
|
|
- data: params
|
|
|
|
|
|
|
+ body: JSON.stringify(params)
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 한마디 삭제
|
|
// 한마디 삭제
|
|
|
export async function fetchRemoveSummary() {
|
|
export async function fetchRemoveSummary() {
|
|
|
- return await fetchJson('/api/account/remove-summary', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/summary', {
|
|
|
method: 'DELETE',
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json',
|
|
'Accept': 'application/json',
|
|
@@ -88,19 +95,19 @@ export async function fetchRemoveSummary() {
|
|
|
|
|
|
|
|
// 자기소개 변경
|
|
// 자기소개 변경
|
|
|
export async function fetchChangeIntro(params: ChangeIntroRequest) {
|
|
export async function fetchChangeIntro(params: ChangeIntroRequest) {
|
|
|
- return await fetchJson('/api/account/change-intro', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/intro', {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json',
|
|
'Accept': 'application/json',
|
|
|
'Content-Type': 'application/json'
|
|
'Content-Type': 'application/json'
|
|
|
},
|
|
},
|
|
|
- data: params
|
|
|
|
|
|
|
+ body: JSON.stringify(params)
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 자기소개 삭제
|
|
// 자기소개 삭제
|
|
|
export async function fetchRemoveIntro() {
|
|
export async function fetchRemoveIntro() {
|
|
|
- return await fetchJson('/api/account/remove-intro', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/intro', {
|
|
|
method: 'DELETE',
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json',
|
|
'Accept': 'application/json',
|
|
@@ -110,34 +117,34 @@ export async function fetchRemoveIntro() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 회원 사진 변경
|
|
// 회원 사진 변경
|
|
|
-export async function fetchChangePhoto(f: File|null): Promise<ResultDto<{photoURL: string}>> {
|
|
|
|
|
|
|
+export async function fetchChangeThumb(f: File|null): Promise<ResultDto<{thumbUrl: string}>> {
|
|
|
const formData = new FormData();
|
|
const formData = new FormData();
|
|
|
- formData.append('photo', f || '');
|
|
|
|
|
|
|
+ formData.append('thumb', f || '');
|
|
|
|
|
|
|
|
- return await fetchJson<{photoURL: string}>('/api/account/change-photo', {
|
|
|
|
|
|
|
+ return await fetchJson<{thumbUrl: string}>('/api/mypage/thumb', {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json'
|
|
'Accept': 'application/json'
|
|
|
},
|
|
},
|
|
|
- data: formData
|
|
|
|
|
|
|
+ body: formData
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 비밀번호 변경
|
|
// 비밀번호 변경
|
|
|
export async function fetchChangePassword(params: ChangePasswordRequest) {
|
|
export async function fetchChangePassword(params: ChangePasswordRequest) {
|
|
|
- return await fetchJson('/api/account/change-password', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/password', {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json',
|
|
'Accept': 'application/json',
|
|
|
'Content-Type': 'application/json'
|
|
'Content-Type': 'application/json'
|
|
|
},
|
|
},
|
|
|
- data: params
|
|
|
|
|
|
|
+ body: JSON.stringify(params)
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 회원탈퇴
|
|
// 회원탈퇴
|
|
|
export async function fetchWithdraw() {
|
|
export async function fetchWithdraw() {
|
|
|
- return await fetchJson('/api/account/withdraw', {
|
|
|
|
|
|
|
+ return await fetchJson('/api/mypage/withdraw', {
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Accept': 'application/json',
|
|
'Accept': 'application/json',
|
|
@@ -147,12 +154,11 @@ export async function fetchWithdraw() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 로그인 기록
|
|
// 로그인 기록
|
|
|
-export async function fetchLoginLog(type: LoginLogType, page: number) {
|
|
|
|
|
- return await fetchJson(`/api/account/login-log?type=${type}&page=${page}`, {
|
|
|
|
|
|
|
+export async function fetchLoginLog(page: number, type: string = 'today', pageSize: number = 20) {
|
|
|
|
|
+ return await fetchJson(`/api/mypage/login-logs?page=${page}&type=${type}&pageSize=${pageSize}`, {
|
|
|
method: 'GET',
|
|
method: 'GET',
|
|
|
headers: {
|
|
headers: {
|
|
|
- 'Accept': 'application/json',
|
|
|
|
|
- 'Content-Type': 'application/json'
|
|
|
|
|
|
|
+ 'Accept': 'application/json'
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
-}
|
|
|
|
|
|
|
+}
|