+
diff --git a/src/components/Pages/Chat/ChatOnetoOne.jsx b/src/components/Pages/Chat/ChatOnetoOne.jsx
index 3d95294..bac0f1c 100644
--- a/src/components/Pages/Chat/ChatOnetoOne.jsx
+++ b/src/components/Pages/Chat/ChatOnetoOne.jsx
@@ -80,7 +80,7 @@ const ChatOnetoOne = ({user, profile}) => {
return (
-
//
//
@@ -249,12 +249,13 @@ import ProjectSlider from "./ProjectSlider";
import { Element, ScrollLink } from "react-scroll";
import axios from "axios";
import { useParams } from "react-router-dom";
+import { toast } from "react-toastify";
const DynamicProfile = () => {
const { user } = useContext(AuthContext);
const { pId } = useParams();
const [profile, setProfile] = useState(null);
- const [loading, setLoading ] = useState(true);
+ const [loading, setLoading] = useState(true);
const [reload, setReload] = useState(false);
const [showComponent, setShowComponent] = useState("Info");
@@ -264,24 +265,46 @@ const DynamicProfile = () => {
document.getElementById("UserEdit").close();
};
-
+ const handleAddUserEdit = async (e) => {
+
+ e.preventDefault();
+ const updateDesignation = {
+ designation: e.target.designation.value,
+ user: user?.userId
+ }
+ console.log({ updateDesignation });
+
+ try {
+ const result = await axios.post(`https://projectsyncifyapi.onrender.com/api/v1/profile/designation/`, updateDesignation)
+ console.log({ result })
+ handleCloseModal();
+ toast.success("Designation updated successfully")
+
+ setReload(!reload)
+ }
+ catch (error) {
+ console.log(error)
+ }
+
+
+ };
useEffect(() => {
-
- const getProfileData = async() => {
+
+ const getProfileData = async () => {
setLoading(true)
- try{
+ try {
const result = await axios.get(`https://projectsyncifyapi.onrender.com/api/v1/profile/${pId}/`)
- console.log({result})
+ console.log({ result })
setProfile(result.data)
setLoading(false)
}
- catch(error){
+ catch (error) {
console.log(error)
setLoading(false)
}
}
- if(user && user.userId){
+ if (user && user.userId) {
getProfileData();
}
}, [user, reload]);
@@ -300,7 +323,7 @@ const DynamicProfile = () => {
alt={profile && profile.get_full_name}
className="w-28 md:w-40 h-28 md:h-40 rounded-full border-4 border-sky-900 dark:border-sky-300"
/>
-
+
@@ -309,7 +332,7 @@ const DynamicProfile = () => {
{" "}
- {profile && profile?.designation?.designation }
+ {profile && profile?.designation?.designation}
{/*
{user && user.email}
*/}
@@ -319,18 +342,16 @@ const DynamicProfile = () => {
setShowComponent("Info")}
- className={`rounded py-1 px-2 text-sm hover:bg-sky-200 dark:hover:bg-sky-300 hover:text-sky-900 ${
- showComponent === "Info" ? "bg-sky-50 dark:bg-sky-950 " : ""
- }`}
+ className={`rounded py-1 px-2 text-sm hover:bg-sky-200 dark:hover:bg-sky-300 hover:text-sky-900 ${showComponent === "Info" ? "bg-sky-50 dark:bg-sky-950 " : ""
+ }`}
>
Info
-
+
setShowComponent("Contact")}
- className={`rounded py-1 px-2 text-sm hover:bg-sky-200 dark:hover:bg-sky-300 hover:text-sky-900 ${
- showComponent === "Contact" ? "bg-sky-50 dark:bg-sky-950" : ""
- }`}
+ className={`rounded py-1 px-2 text-sm hover:bg-sky-200 dark:hover:bg-sky-300 hover:text-sky-900 ${showComponent === "Contact" ? "bg-sky-50 dark:bg-sky-950" : ""
+ }`}
>
Contact
@@ -358,7 +379,7 @@ const DynamicProfile = () => {
Edit
diff --git a/src/pages/shared/Navbar.jsx b/src/pages/shared/Navbar.jsx
index cb71aad..d2c4583 100644
--- a/src/pages/shared/Navbar.jsx
+++ b/src/pages/shared/Navbar.jsx
@@ -90,7 +90,7 @@ const Navbar = ({ handleThemeChange }) => {
const handleProfile = () => {
console.log("profile button clicked");
- navigate("/profile");
+ navigate(`/profile/${user?.userId}`);
};
const [menuVisible, setMenuVisible] = useState(false);