chore: build

This commit is contained in:
2026-06-16 21:17:54 +02:00
parent 440792a066
commit ec7e59550b
11 changed files with 868 additions and 1 deletions
+43
View File
@@ -2201,6 +2201,49 @@ export const getMyPointsRewards = async (): Promise<{
}
};
export const submitLivreurRating = async (
orderId: number,
rating: number,
comment: string,
): Promise<{ success: boolean; error?: string }> => {
const token = getAuthToken();
if (!token) return { success: false, error: "Non authentifié" };
try {
const response = await fetch(`${API_URL}/orders/${orderId}/rate`, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${token}`,
},
body: JSON.stringify({ rating, comment }),
});
if (!response.ok) {
const data = await safeJson(response);
return { success: false, error: data.error || "Erreur" };
}
return { success: true };
} catch {
return { success: false, error: "Erreur de connexion" };
}
};
export const getOrderRatingStatus = async (
orderId: number,
): Promise<{ rated: boolean; rating?: number; comment?: string }> => {
const token = getAuthToken();
if (!token) return { rated: false };
try {
const response = await fetch(`${API_URL}/orders/${orderId}/rating`, {
headers: { Authorization: `Bearer ${token}` },
});
if (!response.ok) return { rated: false };
const data = await safeJson(response);
return data;
} catch {
return { rated: false };
}
};
export const claimMyReward = async (poolKey: string): Promise<{
success: boolean;
description?: string;