responsive name
This commit is contained in:
@@ -190,6 +190,7 @@ export default defineStore('acctMgmtStore', {
|
||||
username: userToEdit,
|
||||
name: newName,
|
||||
is_active: this.currentViewingUser.is_active,
|
||||
is_admin: this.currentViewingUser.is_admin,
|
||||
});
|
||||
return response.status === 200;
|
||||
} catch (error) {
|
||||
@@ -206,6 +207,7 @@ export default defineStore('acctMgmtStore', {
|
||||
name: this.currentViewingUser.name,
|
||||
password: newPwd,
|
||||
is_active: this.currentViewingUser.is_active,
|
||||
is_admin: this.currentViewingUser.is_admin,
|
||||
});
|
||||
return response.status === 200;
|
||||
} catch (error) {
|
||||
@@ -249,13 +251,10 @@ export default defineStore('acctMgmtStore', {
|
||||
*/
|
||||
async getUserDetail(uniqueUsername: string): Promise<boolean> {
|
||||
const apiUserDetail = `/api/users/${uniqueUsername}`;
|
||||
|
||||
try {
|
||||
const response = await this.$axios.get(apiUserDetail);
|
||||
this.currentViewingUser = {
|
||||
...this.currentViewingUser,
|
||||
detail: response.data,
|
||||
};
|
||||
this.currentViewingUser = response.data;
|
||||
this.currentViewingUser.is_admin = response.data.roles.some(role => role.code === 'admin');
|
||||
return response.status === 200;
|
||||
} catch (error) {
|
||||
//不需要跳出錯誤,因為如果是錯誤反而是好事,表示帳號是獨一的
|
||||
|
||||
Reference in New Issue
Block a user