Skip to content

Commit

Permalink
fix: comments on PR
Browse files Browse the repository at this point in the history
Signed-off-by: pranalidhanavade <[email protected]>
  • Loading branch information
pranalidhanavade committed Dec 24, 2024
1 parent c5746bf commit 00998f4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/commonComponents/datatable/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface TableHeader {
width?: string;
}

export interface TableData {
export interface ITableData {
clickId?: string | null;
data: Data[];
}
Expand All @@ -20,7 +20,7 @@ export interface Data {

export interface IDataTable {
header: TableHeader[];
data: TableData[];
data: ITableData[];
loading: boolean;
onInputChange: (e: ChangeEvent<HTMLInputElement>) => void;
refresh: () => void;
Expand Down
32 changes: 16 additions & 16 deletions src/components/Verification/ConnectionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
getConnectionsByOrg,
} from '../../api/connection';
import type { IConnectionListAPIParameter } from '../../api/connection';
import type { TableData } from '../../commonComponents/datatable/interface';
import type { ITableData } from '../../commonComponents/datatable/interface';
import { apiStatusCodes, storageKeys } from '../../config/CommonConstant';
import { AlertComponent } from '../AlertComponent';
import { dateConversion } from '../../utils/DateConversion';
Expand All @@ -33,12 +33,12 @@ type LocalOrgs = {
const ConnectionList = (props: {
selectConnection: (connections: IConnectionList[]) => void;
}) => {
const [connectionList, setConnectionList] = useState<TableData[]>([]);
const [tableData, setTableData] = useState<TableData[]>([]);
const [connectionList, setConnectionList] = useState<ITableData[]>([]);
const [connectionsTableData, setConnectionsTableData] = useState<ITableData[]>([]);
const [localOrgs, setLocalOrgs] = useState<LocalOrgs[]>([]);

const [selectedConnectionList, setSelectedConnectionList] = useState<
TableData[]
ITableData[]
>([]);
const [loading, setLoading] = useState<boolean>(false);
const [listAPIParameter, setListAPIParameter] =
Expand All @@ -52,17 +52,17 @@ const ConnectionList = (props: {
});

useEffect(() => {
let getData: NodeJS.Timeout;
let getConnectionsData: NodeJS.Timeout;

if (listAPIParameter?.search?.length >= 1) {
getData = setTimeout(() => {
getConnectionsData = setTimeout(() => {
getConnectionsVerification(listAPIParameter);
}, 1000);
return () => clearTimeout(getData);
return () => clearTimeout(getConnectionsData);
} else {
getConnectionsVerification(listAPIParameter);
}
return () => clearTimeout(getData);
return () => clearTimeout(getConnectionsData);
}, [listAPIParameter]);

const searchInputChange = (e: ChangeEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -162,7 +162,7 @@ const extractConnectionFields = (item: IConnectionList) => {
};
});

setTableData(connectionsData);
setConnectionsTableData(connectionsData);
} catch (err) {
console.error('Error generating table:', err);
}
Expand Down Expand Up @@ -204,17 +204,17 @@ const extractConnectionFields = (item: IConnectionList) => {


useEffect(() => {
let getData: NodeJS.Timeout;
let getConnectionsData: NodeJS.Timeout;
updateLocalOrgs();
if (listAPIParameter?.search?.length >= 1) {
getData = setTimeout(() => {
getConnectionsData = setTimeout(() => {
getConnectionsVerification(listAPIParameter);
}, 1000);
return () => clearTimeout(getData);
return () => clearTimeout(getConnectionsData);
} else {
getConnectionsVerification(listAPIParameter);
}
return () => clearTimeout(getData);
return () => clearTimeout(getConnectionsData);
}, [listAPIParameter]);

useEffect(() => {
Expand All @@ -237,8 +237,8 @@ const extractConnectionFields = (item: IConnectionList) => {
nextPage: nextPage,
lastPage: lastPage,
});

setConnectionList(data?.data?.data);
const connectionsDataByOrgId = data?.data?.data
setConnectionList(connectionsDataByOrgId);
setError(null);
} else {
setConnectionList([]);
Expand Down Expand Up @@ -301,7 +301,7 @@ const extractConnectionFields = (item: IConnectionList) => {
onInputChange={searchInputChange}
refresh={refreshPage}
header={verification_header}
data={tableData}
data={connectionsTableData}
loading={loading}
currentPage={listAPIParameter?.page}
onPageChange={(page: number) => {
Expand Down

0 comments on commit 00998f4

Please sign in to comment.