Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"react-dom": "^18.2.0",
"react-router-dom": "^6.23.1",
"react-slick": "^0.30.2",
"react-toastify": "^10.0.5",
"slick-carousel": "^1.8.1"
},
"devDependencies": {
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions src/Pages/Profile/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { bearerTokenAtom, currentUserAtom } from "../../atom/atoms";
import default_avatar from "../../public/images/photo-avatar-profil.png";
import { useNavigate } from "react-router-dom";
import UserAgenda from "../../Components/user_agenda/UserAgenda";
import { toast, ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import "./profile.css";

function Profile() {
Expand Down Expand Up @@ -58,7 +60,6 @@ function Profile() {
}
}, [id, token]);


const handleSave = () => {
const updatedUser = {
first_name: firstName,
Expand Down Expand Up @@ -124,8 +125,22 @@ function Profile() {
withCredentials: true,
}
);

toast.success("Mot de passe changé avec succès !", {
position: "top-center"
});
// Reset the password fields
setOldPassword("");
setNewPassword("");
setConfirmPassword("");

} catch (error) {
console.error("Error changing password:", error);
toast.error("Erreur lors du changement de mot de passe.", {
position: "top-center"
}

);
}
};

Expand Down Expand Up @@ -168,7 +183,6 @@ function Profile() {
setModifyPicture(true);
}


if (loading) {
return (
<div>
Expand All @@ -182,6 +196,7 @@ function Profile() {

return (
<>
<ToastContainer />
<section className="h-full">
<div className="title">
{user.id === currentUser.id ? (
Expand Down Expand Up @@ -385,4 +400,4 @@ function Profile() {
);
}

export default Profile;
export default Profile;