import { SendRequest } from '../components/Global/ApiRequest'; const getTotal = async (query = '') => { const prefix = `${query ? `?${query}` : ''}`; const fullUrl = `${import.meta.env.VITE_API_SERVER}/dashboard/${prefix}`; try { const response = await SendRequest({ method: 'get', prefix: `dashboard/${prefix}`, }); return response; } catch (error) { console.error(`[API Call] Failed: GET ${fullUrl}`, error); throw error; } }; const getTotalPermit = async (query = '') => { const prefix = `dashboard/permit-total${query ? `?${query}` : ''}`; const fullUrl = `${import.meta.env.VITE_API_SERVER}/${prefix}`; try { const response = await SendRequest({ method: 'get', prefix, }); return response; } catch (error) { console.error(`[API Call] Failed: GET ${fullUrl}`, error); throw error; } }; const getTotalPermitPerYear = async (query = '') => { const prefix = `dashboard/permit-breakdown${query ? `?${query}` : ''}`; const fullUrl = `${import.meta.env.VITE_API_SERVER}/${prefix}`; try { const response = await SendRequest({ method: 'get', prefix, }); return response; } catch (error) { console.error(`[API Call] Failed: GET ${fullUrl}`, error); throw error; } }; export { getTotal, getTotalPermit, getTotalPermitPerYear };