21 lines
365 B
JavaScript
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,
|
|
};
|