This commit is contained in:
2025-09-17 12:19:00 +07:00
parent 85baae5e30
commit 27b060845b
4 changed files with 229 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
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 };