diff --git a/src/components/SideBarLeft.jsx b/src/components/SideBarLeft.jsx
index 0b1f3d1..9e01d76 100644
--- a/src/components/SideBarLeft.jsx
+++ b/src/components/SideBarLeft.jsx
@@ -17,13 +17,15 @@ import {
export default function SideBarLeft() {
const [isCalendarInfoOpen, setCalendarInfoOpen] = useState(false);
const [selectedCalendar, setSelectedCalendar] = useState(null);
- const [myCalendars, setMyCalendars] = useState([]);
- const [subscribedCalendars, setSubscribedCalendars] = useState([]);
- const navigate = useNavigate();
+ const navigate = useNavigate();
const [checked, setChecked] = useState({});
const [isInviteOpen, setIsInviteOpen] = useState(false);
- const [isCreateCalendarOpen, setIsCreateCalendarOpen] = useState(false);
+ const [isCreateOpen, setIsCreateCalendarOpen] = useState(false);
+
+ const [myCalendars, setMyCalendars] = useState([]);
+ const [subscribedCalendars, setSubscribedCalendars] = useState([]);
+ const [dday, setDday] = useState([]);
const { loggedIn, userInfo } = useAuth();
@@ -31,7 +33,7 @@ export default function SideBarLeft() {
async function fetchData() {
try {
const token = localStorage.getItem("token");
- const [myCalendarsResponse, subscribedCalendarsResponse] =
+ const [myCalendarsResponse, subscribedCalendarsResponse, ddayResponse] =
await Promise.all([
axios.get("/api/calendars/admins", {
headers: { Authorization: `Bearer ${token}` },
@@ -39,6 +41,9 @@ export default function SideBarLeft() {
axios.get(`/api/users/${userInfo.user_id}/subscriptions`, {
headers: { Authorization: `Bearer ${token}` },
}),
+ axios.get(`/api/users/${userInfo.user_id}/favorite-events`, {
+ headers: { Authorization: `Bearer ${token}` },
+ }),
]);
if (myCalendarsResponse.status === 200) {
@@ -47,6 +52,9 @@ export default function SideBarLeft() {
if (subscribedCalendarsResponse.status === 200) {
setSubscribedCalendars(subscribedCalendarsResponse.data);
}
+ if (ddayResponse.status === 200) {
+ setDday(ddayResponse.data.favorite_events);
+ }
} catch (error) {
console.error("캘린더 데이터를 가져오는 중 오류 발생:", error);
}
@@ -55,7 +63,7 @@ export default function SideBarLeft() {
if (userInfo?.user_id) {
fetchData();
}
- }, [userInfo, isCalendarInfoOpen, isCreateCalendarOpen]);
+ }, [userInfo, isCalendarInfoOpen, isCreateOpen]);
const handleToggle = (id) => {
setChecked((prev) => ({
@@ -195,7 +203,7 @@ export default function SideBarLeft() {