diff --git a/src/components/LecturePage.tsx b/src/components/LecturePage.tsx index 6f3e04f..adb3ce8 100644 --- a/src/components/LecturePage.tsx +++ b/src/components/LecturePage.tsx @@ -15,6 +15,8 @@ export type LectureType = { enroll: Boolean | null; }; +let page: number | null; + const LecturePage: FC = () => { const location = useLocation(); const user_id = location.state.user_id; @@ -29,6 +31,7 @@ const LecturePage: FC = () => { setIsProfessor(false); } }); + page = lectureList.length }, [lectureList, isProfessor]); return ( <> @@ -73,7 +76,7 @@ const LecturePage: FC = () => { ))} { lectureList != null && ( - + ) } diff --git a/src/components/NewAssignment.tsx b/src/components/NewAssignment.tsx index 51a3d4f..3db6b0d 100644 --- a/src/components/NewAssignment.tsx +++ b/src/components/NewAssignment.tsx @@ -33,15 +33,17 @@ const newAssignment: FC = () => { const [dueDate, setDueDate] = useState(null); const submitData = (data: any) => { let params = { - lecture_id: location.state.lecture_id, - professor_id: location.state.user_id, - title: data.title, - start_date: startDate, - due_date: dueDate, - description: data.description, + lecture_id: location.state.lecture_id, + professor_id: location.state.user_id, + title: data.title, + start_date: startDate!.toISOString(), + due_date: dueDate!.toISOString(), + description: data.description, }; + setUserId(location.state.user_id); + console.log(params); // TODO 서버 나오면 디버깅 필요 api.client diff --git a/src/components/Paging.tsx b/src/components/Paging.tsx index 4c69709..0879ac4 100644 --- a/src/components/Paging.tsx +++ b/src/components/Paging.tsx @@ -2,8 +2,10 @@ import React, { useState } from "react"; import Pagination from "react-js-pagination"; import "../style/Paging.css"; -const Paging = (count:any) => { +const Paging = (props:any) => { const [page, setPage] = useState(1); + const count = props.data + console.log(props.data) const handlePageChange = (page: number) => { setPage(page); diff --git a/src/props/Lecture.tsx b/src/props/Lecture.tsx index cd74e50..dcaf882 100644 --- a/src/props/Lecture.tsx +++ b/src/props/Lecture.tsx @@ -3,6 +3,7 @@ import axios from "axios"; import {useLocation} from "react-router-dom"; import { useNavigate } from "react-router"; import { LectureType } from "../components/LecturePage"; +import api from "../utils/api"; type LectureProps = { // 부모 컴포넌트에 import 해온 타입을 재사용 @@ -21,8 +22,8 @@ const Lecture = ({ lecture, isProfessor }: LectureProps) => { }; console.log(params); - axios - .post("http://moaroom-back.duckdns.org:8080/lectures/students/enroll", params) + api.client + .post("/lectures/students/enroll", params) .then(function(response) { console.log(response) if (response.data === "강의 신청 완료") {