2
0

fix:修改个人信息界面以及接口

This commit is contained in:
zhongzm
2024-12-13 19:14:29 +08:00
parent bf911bac96
commit 7cf6249fd8
5 changed files with 129 additions and 35 deletions

View File

@@ -106,7 +106,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
return isSuccess;
}
//查询用户信息
async function refreshUserInfo() {
const { data: info, error } = await doGetUserInfo();
if (!error) {
@@ -115,6 +115,16 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
}
return false;
}
/**修改用户信息**/
async function updateUserProfile(info: Api.Auth.ChangeInfoBody) {
try {
await doChangeUserInfo(info);
return true;
} catch (error) {
console.error('Failed to update user profile:', error);
return false;
}
}
/**
* 检查用户信息是否已存在
@@ -141,7 +151,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
endLoading();
return !error;
}
//二维码
async function captcha(email: string) {
if (!email) {
return null;
@@ -161,6 +171,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
refreshUserInfo,
register,
captcha,
checkUserRepeat
checkUserRepeat,
updateUserProfile
};
});