update api
This commit is contained in:
+5
-2
@@ -1,4 +1,4 @@
|
||||
import type {Attachment, CaptchaData, LoginRequest, LoginResponse, RegisterRequest, UpdatePasswordRequest, User, UserAttachType} from "../types";
|
||||
import type {Attachment, CaptchaData, Gender, LoginRequest, LoginResponse, RegisterRequest, UpdatePasswordRequest, User, UserAttachType} from "../types";
|
||||
import {axios} from "./BaseAPI";
|
||||
import CommonAPI from "./CommonAPI";
|
||||
|
||||
@@ -6,6 +6,9 @@ const BASE_URI = "/user";
|
||||
type UserAttachmentOwner = {
|
||||
attachmentList?: readonly Attachment[];
|
||||
};
|
||||
type UpdateCurrentRequest = Omit<Partial<User>, "gender"> & {
|
||||
gender?: Gender | "";
|
||||
};
|
||||
|
||||
async function register(req: CaptchaData<RegisterRequest>): Promise<LoginResponse> {
|
||||
return await axios.post(`${BASE_URI}/register`, req);
|
||||
@@ -34,7 +37,7 @@ async function logout(): Promise<void> {
|
||||
return await axios.post(`${BASE_URI}/logout`);
|
||||
}
|
||||
|
||||
async function updateCurrent(req: Partial<User>): Promise<LoginResponse> {
|
||||
async function updateCurrent(req: UpdateCurrentRequest): Promise<LoginResponse> {
|
||||
return await axios.post(`${BASE_URI}/current/update`, req);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user