Skip to content

Commit 163191e

Browse files
authored
Merge pull request #47 from feliciagan/edit_profile
Debug edit profile
2 parents db281be + e24c294 commit 163191e

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

frontend/src/components/ChangePasswordModal/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ const ChangePasswordModal: React.FC<ChangePasswordModalProps> = (props) => {
6363
required
6464
fullWidth
6565
margin="normal"
66-
{...register("oldPassword")}
66+
{...register("oldPassword", {
67+
required: "Required field",
68+
})}
69+
error={!!errors.oldPassword}
70+
helperText={errors.oldPassword?.message}
6771
/>
6872
<PasswordTextField
6973
displayTooltip

frontend/src/pages/Profile/index.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,19 @@ const ProfilePage: React.FC = () => {
101101
<Box sx={(theme) => ({ flex: 3, paddingLeft: theme.spacing(4) })}>
102102
<Typography variant="h4">Questions attempted</Typography>
103103
</Box>
104-
<EditProfileModal
105-
open={editProfileOpen}
106-
onClose={() => setEditProfileModalOpen(false)}
107-
currFirstName={user.firstName}
108-
currLastName={user.lastName}
109-
currBiography={user.biography}
110-
/>
111-
<ChangePasswordModal
112-
open={passwordModalOpen}
113-
onClose={() => setPasswordModalOpen(false)}
114-
/>
104+
{editProfileOpen &&
105+
<EditProfileModal
106+
open={editProfileOpen}
107+
onClose={() => setEditProfileModalOpen(false)}
108+
currFirstName={user.firstName}
109+
currLastName={user.lastName}
110+
currBiography={user.biography}
111+
/>}
112+
{passwordModalOpen &&
113+
<ChangePasswordModal
114+
open={passwordModalOpen}
115+
onClose={() => setPasswordModalOpen(false)}
116+
/>}
115117
</Box>
116118
</AppMargin>
117119
);

0 commit comments

Comments
 (0)