mirror of
https://github.com/continew-org/continew-admin.git
synced 2026-01-13 20:57:10 +08:00
重构:重构个人中心前端代码
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import axios from 'axios';
|
||||
|
||||
const BASE_URL = '/system/user/center';
|
||||
|
||||
export interface BasicInfoModel {
|
||||
username: string;
|
||||
nickname: string;
|
||||
@@ -9,24 +11,27 @@ export interface BasicInfoModel {
|
||||
export interface AvatarRes {
|
||||
avatar: string;
|
||||
}
|
||||
|
||||
export function uploadAvatar(data: FormData) {
|
||||
return axios.post<AvatarRes>('/system/user/center/avatar', data);
|
||||
return axios.post<AvatarRes>(`${BASE_URL}/avatar`, data);
|
||||
}
|
||||
|
||||
export interface UpdateBasicInfoReq {
|
||||
nickname: string;
|
||||
gender: number;
|
||||
}
|
||||
|
||||
export function updateBasicInfo(req: UpdateBasicInfoReq) {
|
||||
return axios.patch('/system/user/center/basic/info', req);
|
||||
return axios.patch(`${BASE_URL}/basic/info`, req);
|
||||
}
|
||||
|
||||
export interface UpdatePasswordReq {
|
||||
oldPassword: string;
|
||||
newPassword: string;
|
||||
}
|
||||
|
||||
export function updatePassword(req: UpdatePasswordReq) {
|
||||
return axios.patch('/system/user/center/password', req);
|
||||
return axios.patch(`${BASE_URL}/password`, req);
|
||||
}
|
||||
|
||||
export interface UpdateEmailReq {
|
||||
@@ -34,6 +39,7 @@ export interface UpdateEmailReq {
|
||||
captcha: string;
|
||||
currentPassword: string;
|
||||
}
|
||||
|
||||
export function updateEmail(req: UpdateEmailReq) {
|
||||
return axios.patch('/system/user/center/email', req);
|
||||
return axios.patch(`${BASE_URL}/email`, req);
|
||||
}
|
||||
Reference in New Issue
Block a user