diff --git a/apps/console/src/pages/organizations/vendors/VendorView.tsx b/apps/console/src/pages/organizations/vendors/VendorView.tsx index dfc9a97b9..07f4f23c9 100644 --- a/apps/console/src/pages/organizations/vendors/VendorView.tsx +++ b/apps/console/src/pages/organizations/vendors/VendorView.tsx @@ -21,6 +21,7 @@ import type { VendorViewUploadComplianceReportMutation as UploadComplianceReport import type { VendorViewUpdateVendorMutation } from "./__generated__/VendorViewUpdateVendorMutation.graphql"; import type { VendorViewCreateRiskAssessmentMutation } from "./__generated__/VendorViewCreateRiskAssessmentMutation.graphql"; import type { BusinessImpact, DataSensitivity } from "./__generated__/VendorViewCreateRiskAssessmentMutation.graphql"; +import type { VendorViewQuery$data } from "./__generated__/VendorViewQuery.graphql"; import { useParams } from "react-router"; import { cn } from "@/lib/utils"; import { PageTemplate } from "@/components/PageTemplate"; @@ -618,7 +619,7 @@ function RiskAssessmentsTable({ assessments, onCreateAssessment, }: { - assessments: RiskAssessment[]; + assessments: NonNullable["riskAssessments"]>["edges"]; onCreateAssessment: () => void; }) { const [showDropdown, setShowDropdown] = useState(null); @@ -648,12 +649,7 @@ function RiskAssessmentsTable({ }); }; - // Check if assessment is expired - const isExpired = (expiresAt: string) => { - console.log(new Date(expiresAt) < new Date()); - - return new Date(expiresAt) < new Date(); - }; + const isExpired = (expiresAt: string) => new Date(expiresAt) < new Date(); return (
@@ -690,11 +686,12 @@ function RiskAssessmentsTable({ - {assessments.map((assessment) => { - const expired = isExpired(assessment.expiresAt); + {assessments?.map((edge) => { + const assessment = edge?.node; + const expired = isExpired(assessment?.expiresAt || ""); return ( - {formatDate(assessment.assessedAt)} + {formatDate(assessment?.assessedAt || "")} @@ -714,7 +711,7 @@ function RiskAssessmentsTable({ "text-sm font-normal", expired ? "text-[#A0A5A0]" : "text-[#141E12]" )}> - {formatDate(assessment.expiresAt)} + {formatDate(assessment?.expiresAt || "")} {expired && ( @@ -728,7 +725,7 @@ function RiskAssessmentsTable({ "text-sm font-normal", expired ? "text-[#A0A5A0]" : "text-[#141E12]" )}> - {assessment.dataSensitivity.charAt(0) + assessment.dataSensitivity.slice(1).toLowerCase()} + {assessment?.dataSensitivity.charAt(0) + assessment?.dataSensitivity.slice(1).toLowerCase()} @@ -736,7 +733,7 @@ function RiskAssessmentsTable({ "text-sm font-normal", expired ? "text-[#A0A5A0]" : "text-[#141E12]" )}> - {assessment.businessImpact.charAt(0) + assessment.businessImpact.slice(1).toLowerCase()} + {assessment?.businessImpact.charAt(0) + assessment?.businessImpact.slice(1).toLowerCase()} @@ -744,14 +741,14 @@ function RiskAssessmentsTable({ "text-sm font-normal", expired ? "text-[#A0A5A0]" : "text-[#141E12]" )}> - {assessment.assessedBy?.fullName || 'N/A'} + {assessment?.assessedBy?.fullName || 'N/A'} -
+
- {showDropdown === assessment.id && ( + {showDropdown === assessment?.id && (