diff --git a/src/components/UserCard.tsx b/src/components/UserCard.tsx index 9aa675ae..4c0c48d3 100644 --- a/src/components/UserCard.tsx +++ b/src/components/UserCard.tsx @@ -74,11 +74,11 @@ const UserCard = ({user, loggedInUser, onClose, onViewStudents, onViewTeachers, user.type === "corporate" ? user.corporateInformation?.companyInformation.name : user.type === "agent" - ? user.agentInformation.companyName + ? user.agentInformation?.companyName : undefined, ); const [commercialRegistration, setCommercialRegistration] = useState( - user.type === "agent" ? user.agentInformation.commercialRegistration : undefined, + user.type === "agent" ? user.agentInformation?.commercialRegistration : undefined, ); const [userAmount, setUserAmount] = useState(user.type === "corporate" ? user.corporateInformation?.companyInformation.userAmount : undefined); const [paymentValue, setPaymentValue] = useState(user.type === "corporate" ? user.corporateInformation?.payment?.value : undefined); diff --git a/src/pages/profile.tsx b/src/pages/profile.tsx index a71af678..cad6dc35 100644 --- a/src/pages/profile.tsx +++ b/src/pages/profile.tsx @@ -79,13 +79,7 @@ function UserProfile({user, mutateUser}: Props) { const [passport_id, setPassportID] = useState(user.type === "student" ? user.demographicInformation?.passport_id : undefined); const [position, setPosition] = useState(user.type === "corporate" ? user.demographicInformation?.position : undefined); const [corporateInformation, setCorporateInformation] = useState(user.type === "corporate" ? user.corporateInformation : undefined); - const [companyName, setCompanyName] = useState( - user.type === "agent" - ? user.agentInformation?.companyName - : user.type === "corporate" - ? user.corporateInformation?.companyInformation.name - : undefined, - ); + const [companyName, setCompanyName] = useState(user.type === "agent" ? user.agentInformation?.companyName : undefined); const [commercialRegistration, setCommercialRegistration] = useState( user.type === "agent" ? user.agentInformation?.commercialRegistration : undefined, );