#31 Added course page that querys backend for a specific course id
This commit was merged in pull request #40.
This commit is contained in:
30
frontend/src/pages/CoursePage.jsx
Normal file
30
frontend/src/pages/CoursePage.jsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Container } from "react-bootstrap";
|
||||
import MyNavbar from "../components/MyNavbar";
|
||||
import { makeRequest } from "../utils.ts";
|
||||
|
||||
const CoursePage = ({ id }) => {
|
||||
const [courseData, setCourseData] = useState({});
|
||||
|
||||
useEffect(() => {
|
||||
makeRequest({ url: `http://localhost:5000/course/${id}` })
|
||||
.then((resp) => resp.json())
|
||||
.then((data) => {
|
||||
setCourseData(data);
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<MyNavbar />
|
||||
<Container className="p-5 border">
|
||||
<h1>{courseData.name}</h1>
|
||||
<h4 className="mb-4">{courseData.instructor}</h4>
|
||||
<hr />
|
||||
<h4>Assignments</h4>
|
||||
</Container>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CoursePage;
|
||||
Reference in New Issue
Block a user