localhost-front/src/stores/calendarStore.js
2025-01-14 12:46:21 +09:00

21 lines
365 B
JavaScript

import { ref } from 'vue';
import axios from '@api';
const events = ref([]);
const fetchEvents = async () => {
const response = await axios.get('/calendar/events');
events.value = response.data;
};
const addEvent = async (event) => {
await axios.post('/calendar/event', event);
fetchEvents();
};
export default {
events,
fetchEvents,
addEvent,
};