From 04f4346122a919e5a6272fdb5f6a7db3ce341271 Mon Sep 17 00:00:00 2001 From: nevermoregb Date: Fri, 4 Apr 2025 22:59:36 +0900 Subject: [PATCH] 1 --- src/components/main/MainEventCalendar.vue | 14 +++++++++++++- src/stores/useWeatherStore.js | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/main/MainEventCalendar.vue b/src/components/main/MainEventCalendar.vue index 9295536..8cd343b 100644 --- a/src/components/main/MainEventCalendar.vue +++ b/src/components/main/MainEventCalendar.vue @@ -65,6 +65,8 @@ import { useUserInfoStore } from '@/stores/useUserInfoStore'; import { useProjectStore } from '@/stores/useProjectStore'; import { useToastStore } from '@s/toastStore'; + import { useWeatherStore } from '@/stores/useWeatherStore'; + import { storeToRefs } from 'pinia'; import FullCalendar from '@fullcalendar/vue3'; import dayGridPlugin from '@fullcalendar/daygrid'; import interactionPlugin from '@fullcalendar/interaction'; @@ -79,11 +81,14 @@ const user = ref({}); const userStore = useUserInfoStore(); const projectStore = useProjectStore(); + const weatherStore = useWeatherStore(); + const { dailyWeatherList } = storeToRefs(weatherStore); const dayjs = inject('dayjs'); const fullCalendarRef = ref(null); const workTimeComponentRef = ref(null); const calendarEvents = ref([]); + //const dailyWeatherList = ref([]); const selectedProject = ref(null); const checkedInProject = ref(null); @@ -134,7 +139,7 @@ // 기존의 공휴일 이벤트는 유지 const holidayEvents = calendarEvents.value.filter(event => event.classNames?.includes('holiday-event')); - calendarEvents.value = [...holidayEvents]; + calendarEvents.value = [...holidayEvents, ...dailyWeatherList.value]; // 생일자 if (res?.memberBirthdayList?.length) { @@ -550,6 +555,13 @@ param.append('month', month); param.append('day', day); + if (!weatherStore.dailyWeatherList?.length) { + console.log(123); + await weatherStore.getWeatherInfo(); + //dailyWeatherList.value = weatherStore.dailyWeatherList; + console.log('dailyWeatherList.value: ', dailyWeatherList.value); + } + // 이벤트 카테고리 호출 await fetchCategoryList(); await fetchEventList(param); diff --git a/src/stores/useWeatherStore.js b/src/stores/useWeatherStore.js index a863d76..357f48f 100644 --- a/src/stores/useWeatherStore.js +++ b/src/stores/useWeatherStore.js @@ -42,6 +42,7 @@ export const useWeatherStore = defineStore('weather', () => { } dailyWeatherList.value = resData.dailyWeatherList; + console.log('dailyWeatherList.value: ', dailyWeatherList.value); const now = new Date(); const closest = data.list.reduce((prev, curr) => {