import { useState } from "react"; import { Link, useHistory } from "react-router-dom"; import AlertModal from "../Modal/PlanAlertModal"; import planApi from "../../apis/plan.api"; import { useAuth } from "../../utils/context"; import catchErrors from "../../utils/catchErrors"; import styles from "../Schedule/schedule.module.scss"; import styles2 from "./studyplan.module.scss"; import moment from 'moment'; const PlanItem = ({ planList = [], subjectId }) => { const { user } = useAuth() const [error, setError] = useState("") const history = useHistory() async function delPlan(planId) { try { setError("") await planApi.remove(planId, user.id) alert("해당 계획을 성공적으로 삭제했습니다.") history.push(`/studyplan/${subjectId}`) } catch (error) { catchErrors(error, setError) } } return ( <> {planList.length !== 0 ? planList.map((plan, idx) =>
~ {plan.timeChecked ? moment(plan.deadline).format("YY.MM.DD HH:mm") : moment(plan.deadline).format("YY.MM.DD")}
{plan.memo}
수정
) :

등록된 학업 계획이 없습니다.

} ) } export default PlanItem;