44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import axios from "@/config/axios";
|
|
import type {
|
|
IStatisticsResponse,
|
|
IPaymentChartResponse,
|
|
IFoodSalesPieChartResponse,
|
|
} from "../types/Types";
|
|
|
|
export const getStatistics = async (): Promise<IStatisticsResponse> => {
|
|
const { data } = await axios.get<IStatisticsResponse>("/admin/orders/stats");
|
|
return data;
|
|
};
|
|
|
|
interface GetFoodSalesPieChartParams {
|
|
period?: "daily" | "monthly" | "yearly";
|
|
startDate?: string;
|
|
endDate?: string;
|
|
}
|
|
|
|
export const getFoodSalesPieChart = async (
|
|
params?: GetFoodSalesPieChartParams
|
|
): Promise<IFoodSalesPieChartResponse> => {
|
|
const { data } = await axios.get<IFoodSalesPieChartResponse>(
|
|
"/admin/orders/food-sales-pie-chart",
|
|
{ params }
|
|
);
|
|
return data;
|
|
};
|
|
|
|
interface GetPaymentsChartParams {
|
|
period?: "daily" | "monthly" | "yearly";
|
|
startDate?: string;
|
|
endDate?: string;
|
|
}
|
|
|
|
export const getPaymentsChart = async (
|
|
params?: GetPaymentsChartParams
|
|
): Promise<IPaymentChartResponse> => {
|
|
const { data } = await axios.get<IPaymentChartResponse>(
|
|
"/admin/payments/chart",
|
|
{ params }
|
|
);
|
|
return data;
|
|
};
|