{(params) => {
return (
diff --git a/frontend/src/pages/AssignmentEditPage.jsx b/frontend/src/pages/AssignmentEditPage.jsx
new file mode 100644
index 0000000..863ffbe
--- /dev/null
+++ b/frontend/src/pages/AssignmentEditPage.jsx
@@ -0,0 +1,90 @@
+import { useEffect, useState } from "react";
+import { Container, Table, Button, Form } from "react-bootstrap";
+import MyNavbar from "../components/MyNavbar";
+import { makeRequest } from "../utils.ts";
+import { useLocation } from "wouter";
+
+const AssignmentEditPage = ({ id }) => {
+ const [assignmentData, setAssignmentData] = useState({});
+ const [location, setLocation] = useLocation();
+
+ const [name, setName] = useState("");
+ const [description, setDescription] = useState("");
+ const [duedate, setDuedate] = useState("");
+
+ const submitAssignmentForm = (name, description, duedate) => {
+ makeRequest({
+ endpoint: `assignment/${id}`,
+ method: "PUT",
+ body: {
+ name,
+ description,
+ due_date: duedate,
+ },
+ }).then((resp) => {
+ setLocation(`/manage/${assignmentData.course_id}/assignments`);
+ });
+ };
+
+ useEffect(() => {
+ makeRequest({ endpoint: `assignment/${id}` })
+ .then((resp) => resp.json())
+ .then((data) => {
+ setAssignmentData(data);
+ setName(data.name);
+ setDescription(data.description);
+ setDuedate(data.due_date);
+ });
+ }, []);
+
+ return (
+
+
+
+ {assignmentData.name && (
+
+ Name
+ setName(e.target.value)}
+ />
+
+
+ Description
+ setDescription(e.target.value)}
+ />
+
+
+ Due Date
+ setDuedate(e.target.value)}
+ />
+
+
+
+ )}
+
+
+ );
+};
+
+export default AssignmentEditPage;
diff --git a/frontend/src/pages/ManageAssignmentsPage.jsx b/frontend/src/pages/ManageAssignmentsPage.jsx
index 08f5518..1ead633 100644
--- a/frontend/src/pages/ManageAssignmentsPage.jsx
+++ b/frontend/src/pages/ManageAssignmentsPage.jsx
@@ -1,5 +1,6 @@
import { useEffect, useState } from "react";
import { Container, Table, Button, Form } from "react-bootstrap";
+import { useLocation } from "wouter";
import MyNavbar from "../components/MyNavbar";
import { makeRequest } from "../utils.ts";
@@ -7,6 +8,7 @@ const ManageAssignmentsPage = ({ cid }) => {
const [courseData, setCourseData] = useState({});
const [assignmentData, setAssignmentData] = useState([]);
const [showAddAssignmentForm, setShowAddAssignmentForm] = useState(false);
+ const [location, setLocation] = useLocation();
const AddAssignmentForm = () => {
const [name, setName] = useState("");
@@ -42,6 +44,7 @@ const ManageAssignmentsPage = ({ cid }) => {
Due Date
setDuedate(e.target.value)}
/>
@@ -137,6 +140,16 @@ const ManageAssignmentsPage = ({ cid }) => {
+ |