Add optional chaining for response.data.roles access in getUserDetail
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -267,7 +267,7 @@ export const useAcctMgmtStore = defineStore('acctMgmtStore', {
|
|||||||
try {
|
try {
|
||||||
const response = await apiClient.get(apiUserDetail);
|
const response = await apiClient.get(apiUserDetail);
|
||||||
this.currentViewingUser = response.data;
|
this.currentViewingUser = response.data;
|
||||||
this.currentViewingUser.is_admin = response.data.roles.some(role => role.code === 'admin');
|
this.currentViewingUser.is_admin = response.data.roles?.some(role => role.code === 'admin') ?? false;
|
||||||
return response.status === 200;
|
return response.status === 200;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// No need to show an error, because an error here means the account is unique
|
// No need to show an error, because an error here means the account is unique
|
||||||
|
|||||||
Reference in New Issue
Block a user