Profile screen was crashing
This commit is contained in:
@@ -64,6 +64,8 @@ export default function Home() {
|
||||
const [gender, setGender] = useState<Gender>();
|
||||
const [employment, setEmployment] = useState<EmploymentStatus>();
|
||||
const [position, setPosition] = useState<string>();
|
||||
const [companyName, setCompanyName] = useState<string>("");
|
||||
const [commercialRegistration, setCommercialRegistration] = useState<string>("");
|
||||
|
||||
const profilePictureInput = useRef(null);
|
||||
|
||||
@@ -89,6 +91,10 @@ export default function Home() {
|
||||
setGender(user.demographicInformation?.gender);
|
||||
setEmployment(user.type === "corporate" ? undefined : user.demographicInformation?.employment);
|
||||
setPosition(user.type === "corporate" ? user.demographicInformation?.position : undefined);
|
||||
if(user.type === 'agent') {
|
||||
setCompanyName(user.agentInformation?.companyName)
|
||||
setCommercialRegistration(user.agentInformation?.commercialRegistration)
|
||||
}
|
||||
}
|
||||
}, [user]);
|
||||
|
||||
@@ -219,7 +225,7 @@ export default function Home() {
|
||||
name="companyName"
|
||||
onChange={() => null}
|
||||
placeholder="Enter corporate name"
|
||||
defaultValue={user.agentInformation.companyName}
|
||||
defaultValue={companyName}
|
||||
disabled
|
||||
/>
|
||||
<Input
|
||||
@@ -228,7 +234,7 @@ export default function Home() {
|
||||
name="commercialRegistration"
|
||||
onChange={() => null}
|
||||
placeholder="Enter commercial registration"
|
||||
defaultValue={user.agentInformation.commercialRegistration}
|
||||
defaultValue={commercialRegistration}
|
||||
disabled
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user