修复更新用户信息

This commit is contained in:
whyour 2023-12-22 22:13:09 +08:00
parent f8aba4b1fb
commit 62168979e3

View File

@ -242,13 +242,13 @@ export default class UserService {
if (password === 'admin') { if (password === 'admin') {
return { code: 400, message: '密码不能设置为admin' }; return { code: 400, message: '密码不能设置为admin' };
} }
const authInfo = this.getAuthInfo(); const authInfo = await this.getAuthInfo();
this.updateAuthInfo(authInfo, { username, password }); this.updateAuthInfo(authInfo, { username, password });
return { code: 200, message: '更新成功' }; return { code: 200, message: '更新成功' };
} }
public async updateAvatar(avatar: string) { public async updateAvatar(avatar: string) {
const authInfo = this.getAuthInfo(); const authInfo = await this.getAuthInfo();
this.updateAuthInfo(authInfo, { avatar }); this.updateAuthInfo(authInfo, { avatar });
return { code: 200, data: avatar, message: '更新成功' }; return { code: 200, data: avatar, message: '更新成功' };
} }
@ -264,7 +264,7 @@ export default class UserService {
}), }),
); );
} }
return this.getAuthInfo(); return await this.getAuthInfo();
} }
public async initTwoFactor() { public async initTwoFactor() {
@ -317,8 +317,8 @@ export default class UserService {
} }
} }
public deactiveTwoFactor() { public async deactiveTwoFactor() {
const authInfo = this.getAuthInfo(); const authInfo = await this.getAuthInfo();
this.updateAuthInfo(authInfo, { this.updateAuthInfo(authInfo, {
twoFactorActivated: false, twoFactorActivated: false,
twoFactorActived: false, twoFactorActived: false,