From 91c6f5e54cba3e50350d357b059809065696ab5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Mon, 9 Mar 2026 17:10:12 +0800 Subject: [PATCH] Add optional chaining for response.data.roles access in getUserDetail Co-Authored-By: Claude Opus 4.6 --- src/stores/acctMgmt.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stores/acctMgmt.ts b/src/stores/acctMgmt.ts index 0ff21ae..5020f37 100644 --- a/src/stores/acctMgmt.ts +++ b/src/stores/acctMgmt.ts @@ -267,7 +267,7 @@ export const useAcctMgmtStore = defineStore('acctMgmtStore', { try { const response = await apiClient.get(apiUserDetail); 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; } catch (error) { // No need to show an error, because an error here means the account is unique