import { ref } from "vue";
import { getCalendar } from "../services/company";

export default function useCalendar() {
    const loads = ref([]);
    const loading = ref(false);

    const getCalendarDate = async(startDate, endDate) => {
        loading.value = true;
        const resp = await getCalendar(startDate, endDate);
        if(resp === null) {
            loading.value = false;
            loads.value = [];
            return;
        }
        loads.value = resp.data.data;
        loading.value = false;
    }

    return {
        getCalendarDate,
        loads,
        loading
    }
}