File tree Expand file tree Collapse file tree 2 files changed +18
-12
lines changed
components/ChangePasswordModal Expand file tree Collapse file tree 2 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -63,7 +63,11 @@ const ChangePasswordModal: React.FC<ChangePasswordModalProps> = (props) => {
63
63
required
64
64
fullWidth
65
65
margin = "normal"
66
- { ...register ( "oldPassword" ) }
66
+ { ...register ( "oldPassword" , {
67
+ required : "Required field" ,
68
+ } ) }
69
+ error = { ! ! errors . oldPassword }
70
+ helperText = { errors . oldPassword ?. message }
67
71
/>
68
72
< PasswordTextField
69
73
displayTooltip
Original file line number Diff line number Diff line change @@ -101,17 +101,19 @@ const ProfilePage: React.FC = () => {
101
101
< Box sx = { ( theme ) => ( { flex : 3 , paddingLeft : theme . spacing ( 4 ) } ) } >
102
102
< Typography variant = "h4" > Questions attempted</ Typography >
103
103
</ 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
+ /> }
115
117
</ Box >
116
118
</ AppMargin >
117
119
) ;
You can’t perform that action at this time.
0 commit comments