diff --git a/src/commonComponents/QRcode.tsx b/src/commonComponents/QRcode.tsx index 4d51e1099..3bf1864d4 100644 --- a/src/commonComponents/QRcode.tsx +++ b/src/commonComponents/QRcode.tsx @@ -4,7 +4,8 @@ import domtoimage from 'dom-to-image'; const CustomQRCode = ({ value, size }: { value: string, size: number }) => { - const inputRef = useRef(null); + const node = document.createTextNode(''); + const inputRef = useRef(node); const [isCopied, setIsCopied] = useState(false); function copyTextVal(e: React.MouseEvent) { @@ -24,7 +25,7 @@ const CustomQRCode = ({ value, size }: { value: string, size: number }) => { } const drawHtmlToCanvas = () => { - domtoimage.toJpeg(inputRef.current, { quality: 0.95 }) + domtoimage.toJpeg(inputRef.current, { quality: 0.95 }) .then(function (dataUrl) { var link = document.createElement('a'); link.download = 'my-image-name.jpeg'; diff --git a/src/components/Issuance/IssuedCrdentials.tsx b/src/components/Issuance/IssuedCrdentials.tsx index 95ebd77c0..b10b846d6 100644 --- a/src/components/Issuance/IssuedCrdentials.tsx +++ b/src/components/Issuance/IssuedCrdentials.tsx @@ -170,14 +170,15 @@ const CredentialList = () => { const response = await getOrganizationById(orgId); const { data } = response as AxiosResponse; if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - const did = data?.data?.org_agents?.[0]?.orgDid; - - await setToLocalStorage(storageKeys.ORG_DID, did) - if (did.includes(DidMethod.POLYGON) || did.includes(DidMethod.KEY) || did.includes(DidMethod.WEB)) { - setW3CSchema(true); - } - if (did.includes(DidMethod.INDY)) { - setW3CSchema(false); + const did = data?.data?.org_agents[0]?.orgDid; + if (did) { + await setToLocalStorage(storageKeys.ORG_DID, did) + if (did.includes(DidMethod.POLYGON) || did.includes(DidMethod.KEY) || did.includes(DidMethod.WEB)) { + setW3CSchema(true); + } + if (did.includes(DidMethod.INDY)) { + setW3CSchema(false); + } } } setLoading(false); diff --git a/src/components/Profile/DisplayProfileImg.tsx b/src/components/Profile/DisplayProfileImg.tsx index bebfd4d53..36e80fef8 100644 --- a/src/components/Profile/DisplayProfileImg.tsx +++ b/src/components/Profile/DisplayProfileImg.tsx @@ -11,8 +11,11 @@ const DisplayProfileImg = () => { const userProfile = await getFromLocalStorage(storageKeys.USER_PROFILE) const orgRoles = await getFromLocalStorage(storageKeys.ORG_ROLES) const parsedUser = userProfile ? JSON.parse(userProfile) : null; - parsedUser.roles = orgRoles - setUserObj(parsedUser) + + if (parsedUser) { + parsedUser.roles = orgRoles; + setUserObj(parsedUser); + } } useEffect(() => { diff --git a/src/components/Profile/DisplayUser.tsx b/src/components/Profile/DisplayUser.tsx index 83a704006..fbc238f09 100644 --- a/src/components/Profile/DisplayUser.tsx +++ b/src/components/Profile/DisplayUser.tsx @@ -13,8 +13,11 @@ const DisplayUser = () => { const userProfile = await getFromLocalStorage(storageKeys.USER_PROFILE) const orgRoles = await getFromLocalStorage(storageKeys.ORG_ROLES) const parsedUser = userProfile ? JSON.parse(userProfile) : null - parsedUser.roles = orgRoles - setUserObj(parsedUser) + + if (parsedUser) { + parsedUser.roles = orgRoles; + setUserObj(parsedUser); + } } useEffect(() => { const fetchData = async () => { @@ -39,10 +42,10 @@ const DisplayUser = () => { className="text-xl font-medium text-gray-900 truncate dark:text-gray-300 mb-1" role="none" > - {userObj['firstName']} + {userObj?.['firstName']}

- {userObj['email']} + {userObj?.['email']}

{ 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); };