chore: build
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import apiClient, { API_BASE_URL } from "./client";
|
||||
import apiClient from "./client";
|
||||
import { API_BASE_URL } from "./client";
|
||||
import type {
|
||||
DeliveryStatus,
|
||||
QueueInfo,
|
||||
@@ -9,10 +10,6 @@ import type {
|
||||
|
||||
const API = `${API_BASE_URL}/api/v1/livreur`;
|
||||
|
||||
// ============================================
|
||||
// STATUT
|
||||
// ============================================
|
||||
|
||||
export const getMyStatus = async (): Promise<{
|
||||
success: boolean;
|
||||
status?: DeliveryStatus;
|
||||
@@ -45,10 +42,6 @@ export const updateMyStatus = async (
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// QUEUE
|
||||
// ============================================
|
||||
|
||||
export const getMyQueue = async (): Promise<{
|
||||
success: boolean;
|
||||
queue_info?: QueueInfo;
|
||||
@@ -65,10 +58,6 @@ export const getMyQueue = async (): Promise<{
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// LIVRAISONS
|
||||
// ============================================
|
||||
|
||||
export const getMyDeliveries = async (): Promise<{
|
||||
success: boolean;
|
||||
deliveries?: DeliveryItem[];
|
||||
@@ -383,6 +372,28 @@ export const ISSUE_LABELS: Record<IssueType, string> = {
|
||||
other: "Autre",
|
||||
};
|
||||
|
||||
export type StatPoint = { label: string; count: number; revenue: number };
|
||||
|
||||
export const getMyStats = async (): Promise<{
|
||||
success: boolean;
|
||||
by_day?: StatPoint[];
|
||||
by_week?: StatPoint[];
|
||||
by_month?: StatPoint[];
|
||||
error?: string;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${API}/stats`);
|
||||
return {
|
||||
success: true,
|
||||
by_day: data.by_day || [],
|
||||
by_week: data.by_week || [],
|
||||
by_month: data.by_month || [],
|
||||
};
|
||||
} catch (error: any) {
|
||||
return { success: false, error: error.response?.data?.error || "Erreur réseau" };
|
||||
}
|
||||
};
|
||||
|
||||
export const reportDeliveryIssue = async (
|
||||
deliveryId: number,
|
||||
issueType: IssueType,
|
||||
|
||||
Reference in New Issue
Block a user