import api from "@/network/axiosSetup"
import { toDateOnly } from "@/utils/utils"

async function fetchDashboardData(spaceId: number, startDate: Date, endDate: Date) {
    try {
        const result = await api.get(`/spaces/${spaceId}/dashboard?startDate=${toDateOnly(startDate)}&endDate=${toDateOnly(endDate)}`)
        return result.data
    } catch (error) {
        console.error(error)
        throw error
    }
}




export const DashboardService = {
    fetchDashboardData
}