import { useState, useEffect } from "react"; import Item from "../AdminScheduleItem.js"; import scheduleApi from "../../apis/schedule.api"; import catchErrors from "../../utils/catchErrors.js"; import moment from 'moment'; import styles from "./modal.module.scss"; const ScheduleModal = ({ dateShow, setDateShow }) => { const [scheduleList, setScheduleList] = useState([]) const [error, setError] = useState("") useEffect(() => { if (dateShow.show) getSchedule() }, [dateShow]) async function getSchedule() { try { setError("") const resList = await scheduleApi.getbyDate(dateShow.date) setScheduleList(resList) } catch (error) { catchErrors(error, setError) } } async function delSchedule(id) { try { setError("") await scheduleApi.remove(id) alert("해당 일정을 삭제했습니다.") getSchedule() } catch (error) { catchErrors(error, setError) } } return ( <> {dateShow.show ?
: null} ) } export default ScheduleModal