update users table with unique tag

This commit is contained in:
steven
2021-12-12 14:00:25 +08:00
parent 9db1f57307
commit b20741cca8
8 changed files with 103 additions and 20 deletions

View File

@ -6,7 +6,7 @@ type ResponseType<T = unknown> = {
data: T;
};
async function request<T>(method: string, url: string, data?: BasicType): Promise<ResponseType<T>> {
async function request<T>(method: string, url: string, data?: any): Promise<ResponseType<T>> {
const requestConfig: RequestInit = {
method,
};
@ -55,13 +55,15 @@ namespace api {
return request<boolean>("POST", "/api/user/validpassword", { password });
}
export function updateUserinfo(username?: string, password?: string, githubName?: string, wxOpenId?: string) {
return request("PATCH", "/api/user/me", {
username,
password,
githubName,
wxOpenId,
});
interface UserInfoPatch {
username?: string;
password?: string;
githubName?: string;
wxOpenId?: string;
}
export function updateUserinfo(userinfo: UserInfoPatch) {
return request("PATCH", "/api/user/me", userinfo);
}
export function getMyMemos() {