Skip to content

Commit e9f4627

Browse files
committed
Update Edit Profile Page to include profile sidebar
1 parent 19fdfe5 commit e9f4627

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

Frontend/src/components/user/EditProfile.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {useNavigate, useParams} from 'react-router-dom';
44
import userService from "../../services/users"
55
import InputField from "../auth/InputField";
66

7-
function EditProfile() {
7+
const EditProfile = () => {
88
const navigate = useNavigate();
99
const { id } = useParams(); // Access the id from the route
1010
const [userData, setUserData] = useState(null);
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import React, { useState, useEffect } from 'react';
2+
import NavigationBar from '../NavigationBar';
3+
import ProfileSidebar from './ProfileSidebar';
4+
import EditProfile from './EditProfile';
5+
import { getUserFromToken } from "./utils/authUtils";
6+
7+
function EditProfilePage() {
8+
const [userID, setUserID] = useState(null);
9+
10+
useEffect(() => {
11+
async function fetchData() {
12+
try {
13+
const user = await getUserFromToken();
14+
if (user) {
15+
setUserID(user.userId); // asynchronous
16+
console.log(`I have gotten the user id in edit profile page: ${user.userId}`)
17+
}
18+
} catch (error) {
19+
console.error('Error fetching user ID in edit profile page component:', error);
20+
}
21+
}
22+
fetchData();
23+
}, []);
24+
25+
26+
27+
return(
28+
<div>
29+
<NavigationBar/>
30+
<div className="row">
31+
<div className="Navbar col-2">
32+
<ProfileSidebar userID={userID}/>
33+
</div>
34+
<div className="col-10">
35+
<EditProfile/>
36+
</div>
37+
</div>
38+
</div>
39+
);
40+
}
41+
42+
export default EditProfilePage;

0 commit comments

Comments
 (0)