Skip to content

Commit 9ff2805

Browse files
committed
Merge remote-tracking branch 'origin/hist' into hist
2 parents f9c1f87 + 563ceb5 commit 9ff2805

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Frontend/src/components/user/HistoryPage.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ import HistoryTable from './HistoryTable';
44
import ProfileSidebar from './ProfileSidebar';
55
import { getUserFromToken } from "./utils/authUtils";
66

7-
// get question title and create current time
8-
// get request successful
97

108

119
function HistoryPage() {
1210
const [userID, setUserID] = useState(null);
1311
const [username, setUsername] = useState(null);
1412

13+
1514
useEffect(() => {
1615
async function fetchData() {
1716
try {
@@ -20,6 +19,7 @@ function HistoryPage() {
2019
setUserID(user.userId); // asynchronous
2120
setUsername(user.username); // asynchronous
2221
console.log(`I have gotten the user id in history page: ${user.userId} ${user.username}`)
22+
2323
}
2424
} catch (error) {
2525
console.error('Error fetching user ID in history page component:', error);
@@ -35,7 +35,7 @@ function HistoryPage() {
3535
<NavigationBar/>
3636
<div className="row">
3737
<div className="Navbar col-2">
38-
<ProfileSidebar userID={userID} username={username} />
38+
<ProfileSidebar userID={userID}/>
3939
</div>
4040
<div className="col-10">
4141
<HistoryTable userID={userID}/>

Frontend/src/services/history.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ const getHistoryByUserId = (userId) => {
99

1010
// Sample function to add a new history attempt (optional)
1111
const createHistoryAttempt = async (newAttempt) => {
12-
const response = await axios.post(baseUrl, newAttempt);
12+
const response = await axios.post(baseUrl, newAttempt, {
13+
headers: { Authorization: `Bearer ${sessionStorage.getItem('jwt_token')}` },
14+
});
1315
return response.data;
1416
};
1517

0 commit comments

Comments
 (0)