From 59322552a14986e3feec2b7a37b80c442ae86628 Mon Sep 17 00:00:00 2001 From: prasadgkalamkar Date: Tue, 3 Dec 2024 19:11:44 +0530 Subject: [PATCH] Fix for orgDid missing value (#831) * Fix for orgDid missing value Signed-off-by: prasadgkalamkar * CREDEBL-176: optional chaining added Signed-off-by: prasadgkalamkar * optional chaining corrected Signed-off-by: prasadgkalamkar * refactored logic for orgAgentList and orgDid Signed-off-by: prasadgkalamkar --------- Signed-off-by: prasadgkalamkar --- src/components/User/UserDashBoard.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/User/UserDashBoard.tsx b/src/components/User/UserDashBoard.tsx index 5c6f5b547..ee3b53c97 100644 --- a/src/components/User/UserDashBoard.tsx +++ b/src/components/User/UserDashBoard.tsx @@ -273,15 +273,17 @@ const UserDashBoard = () => { const response = await getOrganizationById(orgId); const { data } = response as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - const orgDid = data?.data?.org_agents[0].orgDid - if (data?.data?.org_agents) { + const orgAgentsList = data?.data?.org_agents; + if (orgAgentsList && orgAgentsList.length > 0) { + const orgDid = orgAgentsList[0].orgDid; setWalletData(data?.data?.org_agents); + + if(orgDid?.includes(DidMethod.INDY)){ + setIsW3C(false); + } } else { setWalletData([]); } - if(orgDid.includes(DidMethod.INDY)){ - setIsW3C(false); - } } setWalletLoading(false); };