This repository was archived by the owner on Apr 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
src/components/pages/User Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,15 @@ export default function Profile(): ReactElement {
29
29
}
30
30
}
31
31
32
- function handleEditModeChange ( ) : void {
32
+ function changeEditMode ( ) : void {
33
33
console . log ( "[PROFILE] changedEditMode" )
34
34
setIsEditing ( ! isEditing )
35
35
}
36
36
37
- const handleSubmit = async ( ) => {
37
+ const handleSubmit = ( ) => {
38
38
console . log ( "[PROFILE] handleSubmit" )
39
- console . log ( changeUserInformation ( newUser ) )
39
+ //console.log(changeUserInformation(newUser))
40
+ changeEditMode ( )
40
41
}
41
42
42
43
/*function EditProfile(): ReactElement {
@@ -100,7 +101,7 @@ export default function Profile(): ReactElement {
100
101
< h1 className = "mr-1 h4" >
101
102
My Profile
102
103
</ h1 >
103
- < Button onClick = { handleEditModeChange } > { isEditing ? "Save Changes " : "Edit Informations " } </ Button >
104
+ { isEditing ? < > </ > : < Button onClick = { changeEditMode } disabled = { isEditing } > { isEditing ? "Editing " : "Edit Information " } </ Button > }
104
105
</ Row >
105
106
</ Container >
106
107
{ isEditing ? < EditProfile /> : < DisplayProfile /> }
Original file line number Diff line number Diff line change @@ -38,7 +38,6 @@ export default function UserInformationInput(props: Props): ReactElement {
38
38
const [ passwordInformationUppercase , setPasswordInformationUppercase ] = useState < boolean > ( false ) ;
39
39
const [ passwordInformationNumber , setPasswordInformationNumber ] = useState < boolean > ( false ) ;
40
40
const [ passwordsMatch , setPasswordsMatch ] = useState < boolean > ( true ) ;
41
- const [ submitted , setSubmitted ] = useState < boolean > ( false ) ;
42
41
43
42
const reviewPasswordMatch = useCallback ( ( ) : void => {
44
43
setPasswordsMatch ( password === passwordConfirmation ) ;
@@ -50,10 +49,9 @@ export default function UserInformationInput(props: Props): ReactElement {
50
49
51
50
useEffect ( ( ) => {
52
51
//TODO: [UserInformationInput.tsx] without submitted submitFunction triggers on site load
53
- if ( submitted ) {
52
+ console . log ( "[UserInformationInput] in submit useEffect" )
54
53
submitFunction ( ) ;
55
- }
56
- } , [ submitted , newUser ] )
54
+ } , [ newUser ] )
57
55
58
56
const makePasswordInputFitRules = ( input : string ) : [ string , boolean ] => {
59
57
input = deleteSpaces ( input ) ;
@@ -95,7 +93,6 @@ export default function UserInformationInput(props: Props): ReactElement {
95
93
console . log ( "[UserInformationInput] handleSubmit" )
96
94
reviewPasswordMatch ( ) ;
97
95
setNewUser ( { username : username , password : password , passwordConfirmation : passwordConfirmation } )
98
- setSubmitted ( true )
99
96
}
100
97
101
98
return (
You can’t perform that action at this time.
0 commit comments