From 2fd0585c321a95a2a0b2a4b5239afe2c38d5fc1b Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 1 Nov 2023 17:39:44 +0530 Subject: [PATCH] fix: connection list issue and verification popup issue Signed-off-by: karan --- src/components/ConnectionsList/index.tsx | 64 ++++++++++--------- .../Verification/SchemaCredDefDetails.tsx | 2 +- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/components/ConnectionsList/index.tsx b/src/components/ConnectionsList/index.tsx index 2ec479ef2..261bf6045 100644 --- a/src/components/ConnectionsList/index.tsx +++ b/src/components/ConnectionsList/index.tsx @@ -5,13 +5,14 @@ import { useEffect, useState } from 'react'; import { getConnectionsByOrg } from '../../api/connection'; import DataTable from '../../commonComponents/datatable'; import type { TableData } from '../../commonComponents/datatable/interface'; -import { apiStatusCodes } from '../../config/CommonConstant'; +import { apiStatusCodes, storageKeys } from '../../config/CommonConstant'; import { AlertComponent } from '../AlertComponent'; import { dateConversion } from '../../utils/DateConversion'; import DateTooltip from '../Tooltip'; import BreadCrumbs from '../BreadCrumbs'; import CustomSpinner from '../CustomSpinner'; import { EmptyListMessage } from '../EmptyListComponent'; +import { getFromLocalStorage } from '../../api/Auth'; const ConnectionList = () => { const [connectionList, setConnectionList] = useState([]); @@ -23,35 +24,38 @@ const ConnectionList = () => { }, []); const getConnections = async () => { - setLoading(true); - const response = await getConnectionsByOrg(); - const { data } = response as AxiosResponse; - - if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { - const connections = data?.data?.map( - (ele: { theirLabel: string; id: string; createdAt: string }) => { - const userName = ele?.theirLabel ? ele.theirLabel : 'Not available'; - const connectionId = ele.id ? ele.id : 'Not available'; - const createdOn = ele?.createdAt ? ele?.createdAt : 'Not available'; - return { - data: [ - { data: userName }, - { data: connectionId }, - { - data: ( - - {' '} - {dateConversion(createdOn)}{' '} - - ), - }, - ], - }; - }, - ); - setConnectionList(connections); - } else { - setError(response as string); + const orgId= await getFromLocalStorage(storageKeys.ORG_ID) + if(orgId){ + setLoading(true); + const response = await getConnectionsByOrg(); + const { data } = response as AxiosResponse; + + if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) { + const connections = data?.data?.map( + (ele: { theirLabel: string; id: string; createdAt: string }) => { + const userName = ele?.theirLabel ? ele.theirLabel : 'Not available'; + const connectionId = ele.id ? ele.id : 'Not available'; + const createdOn = ele?.createdAt ? ele?.createdAt : 'Not available'; + return { + data: [ + { data: userName }, + { data: connectionId }, + { + data: ( + + {' '} + {dateConversion(createdOn)}{' '} + + ), + }, + ], + }; + }, + ); + setConnectionList(connections); + } else { + setError(response as string); + } } setLoading(false); }; diff --git a/src/components/Verification/SchemaCredDefDetails.tsx b/src/components/Verification/SchemaCredDefDetails.tsx index f0251d8a5..a99309352 100644 --- a/src/components/Verification/SchemaCredDefDetails.tsx +++ b/src/components/Verification/SchemaCredDefDetails.tsx @@ -32,7 +32,7 @@ const SchemaCredDefDetails = ({ schemaCredDefList }: SchemaCredDefProps) => { {Object.values(item)[1] ? (
-
+
{Object.values(item)[1] ? 'CredDef Id' : ''}
{' '}