Skip to content

Commit

Permalink
Merge pull request #402 from credebl/fix-connection-issue
Browse files Browse the repository at this point in the history
Fix connection list issue
  • Loading branch information
nishad-ayanworks authored Nov 1, 2023
2 parents 1a26db8 + 79a1132 commit 3e9c106
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
64 changes: 34 additions & 30 deletions src/components/ConnectionsList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<TableData[]>([]);
Expand All @@ -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: (
<DateTooltip date={createdOn} id="issuance_connection_list">
{' '}
{dateConversion(createdOn)}{' '}
</DateTooltip>
),
},
],
};
},
);
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: (
<DateTooltip date={createdOn} id="issuance_connection_list">
{' '}
{dateConversion(createdOn)}{' '}
</DateTooltip>
),
},
],
};
},
);
setConnectionList(connections);
} else {
setError(response as string);
}
}
setLoading(false);
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/Verification/SchemaCredDefDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const SchemaCredDefDetails = ({ schemaCredDefList }: SchemaCredDefProps) => {

{Object.values(item)[1] ? (
<div className="flex flex-start mb-2 w-full ">
<div className="w-3/12 font-semibold text-primary-700 dark:bg-gray-800 m-1 p-1 flex justify-start items-center">
<div className="w-3/12 font-semibold text-primary-700 dark:bg-gray-800 m-1 p-1 flex justify-start items-center text-start">
{Object.values(item)[1] ? 'CredDef Id' : ''}
</div>{' '}
<div className="flex items-center p-1 m-1">
Expand Down

0 comments on commit 3e9c106

Please sign in to comment.