19 lines
538 B
JavaScript
19 lines
538 B
JavaScript
// src/api/holiday.js
|
|
import axios from "@api";
|
|
|
|
export async function fetchHolidays(year, month) {
|
|
try {
|
|
const response = await axios.get(`vacation/${year}/${month}`);
|
|
const holidayEvents = response.data.map((holiday) => ({
|
|
title: holiday.name,
|
|
start: holiday.date, // "YYYY-MM-DD" 형식
|
|
backgroundColor: "#ff6666",
|
|
classNames: ["holiday-event"],
|
|
}));
|
|
return holidayEvents;
|
|
} catch (error) {
|
|
console.error("공휴일 정보를 불러오지 못했습니다.", error);
|
|
return [];
|
|
}
|
|
}
|