Skip to content

Commit 4d28dc6

Browse files
committed
add confirmation msg to Password Edit/Cancel #29
1 parent 2c5d08a commit 4d28dc6

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/pages/profiles/UserPasswordForm.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ import { useHistory, useParams } from "react-router-dom";
1111
import { axiosRes } from "../../api/axiosDefaults";
1212
import { useCurrentUser } from "../../contexts/CurrentUserContext";
1313

14+
// feedback messages for user CRUD
15+
import { toast } from "react-toastify";
16+
import "react-toastify/dist/ReactToastify.css";
17+
1418
import btnStyles from "../../styles/Button.module.css";
1519
import appStyles from "../../App.module.css";
1620

@@ -52,6 +56,15 @@ const UserPasswordForm = () => {
5256
}
5357
};
5458

59+
// feedback messages for user CRUD
60+
const passwordEditSuccessMsg = () => {
61+
toast.success("You have successfully changed your password 🎉");
62+
};
63+
64+
const passwordEditCancelMsg = () => {
65+
toast.success("You chose not to change your password 👍");
66+
};
67+
5568
return (
5669
<Row>
5770
<Col className="py-2 mx-auto text-center" md={6}>
@@ -89,13 +102,19 @@ const UserPasswordForm = () => {
89102
))}
90103
<Button
91104
className={`${btnStyles.Button} ${btnStyles.Blue}`}
92-
onClick={() => history.goBack()}
105+
onClick={() => {
106+
history.goBack();
107+
passwordEditCancelMsg();
108+
}}
93109
>
94110
cancel
95111
</Button>
96112
<Button
97113
type="submit"
98114
className={`${btnStyles.Button} ${btnStyles.Blue}`}
115+
onClick={() => {
116+
passwordEditSuccessMsg();
117+
}}
99118
>
100119
save
101120
</Button>

0 commit comments

Comments
 (0)