Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 3840c7a

Browse files
committed
WIP
1 parent 980fb7a commit 3840c7a

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/components/pages/User/Profile.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@ export default function Profile(): ReactElement {
2929
}
3030
}
3131

32-
function handleEditModeChange(): void {
32+
function changeEditMode(): void {
3333
console.log("[PROFILE] changedEditMode")
3434
setIsEditing(!isEditing)
3535
}
3636

37-
const handleSubmit = async () => {
37+
const handleSubmit = () => {
3838
console.log("[PROFILE] handleSubmit")
39-
console.log(changeUserInformation(newUser))
39+
//console.log(changeUserInformation(newUser))
40+
changeEditMode()
4041
}
4142

4243
/*function EditProfile(): ReactElement {
@@ -100,7 +101,7 @@ export default function Profile(): ReactElement {
100101
<h1 className="mr-1 h4">
101102
My Profile
102103
</h1>
103-
<Button onClick={handleEditModeChange}>{isEditing ? "Save Changes" : "Edit Informations"}</Button>
104+
{isEditing ? <></> : <Button onClick={changeEditMode} disabled={isEditing}>{isEditing ? "Editing" : "Edit Information"}</Button>}
104105
</Row>
105106
</Container>
106107
{isEditing ? <EditProfile/> : <DisplayProfile/>}

src/components/pages/User/UserInformationInput.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export default function UserInformationInput(props: Props): ReactElement {
3838
const [passwordInformationUppercase, setPasswordInformationUppercase] = useState<boolean>(false);
3939
const [passwordInformationNumber, setPasswordInformationNumber] = useState<boolean>(false);
4040
const [passwordsMatch, setPasswordsMatch] = useState<boolean>(true);
41-
const [submitted, setSubmitted] = useState<boolean>(false);
4241

4342
const reviewPasswordMatch = useCallback((): void => {
4443
setPasswordsMatch(password === passwordConfirmation);
@@ -50,10 +49,9 @@ export default function UserInformationInput(props: Props): ReactElement {
5049

5150
useEffect(() => {
5251
//TODO: [UserInformationInput.tsx] without submitted submitFunction triggers on site load
53-
if (submitted){
52+
console.log("[UserInformationInput] in submit useEffect")
5453
submitFunction();
55-
}
56-
}, [submitted, newUser])
54+
}, [newUser])
5755

5856
const makePasswordInputFitRules = (input: string): [string, boolean] => {
5957
input = deleteSpaces(input);
@@ -95,7 +93,6 @@ export default function UserInformationInput(props: Props): ReactElement {
9593
console.log("[UserInformationInput] handleSubmit")
9694
reviewPasswordMatch();
9795
setNewUser({username: username, password: password, passwordConfirmation: passwordConfirmation})
98-
setSubmitted(true)
9996
}
10097

10198
return (

0 commit comments

Comments
 (0)