chore: fix

This commit is contained in:
2026-05-03 19:38:29 +02:00
parent 4075ae2568
commit f8473b9a54
27 changed files with 608 additions and 115 deletions
+5 -5
View File
@@ -330,8 +330,8 @@ export const changePassword = async (
export interface BasketResponse {
success: boolean;
message?: string;
panier?: any[];
data?: { panier?: any[] };
panier?: Record<string, unknown>[];
data?: { panier?: Record<string, unknown>[] };
}
/**
@@ -569,7 +569,7 @@ export const clearCart = async (username: string) => {
success: false,
message: errorData.error || "Erreur vidage",
};
} catch (parseError) {
} catch {
// Si le parsing JSON échoue (HTML retourné)
console.error("❌ [CLEAR] Réponse non-JSON du serveur");
return {
@@ -1206,7 +1206,7 @@ export const getOrderTotal = async (commandId: number): Promise<number> => {
}
};
export const calculateOrderTotal = (order: any): number => {
export const calculateOrderTotal = (order: Record<string, unknown>): number => {
// Préférer total (colonne calculée par le backend)
if (typeof order.total === "number" && order.total > 0) {
return order.total;
@@ -1219,7 +1219,7 @@ export const calculateOrderTotal = (order: any): number => {
// Fallback: calculer depuis les items si présents
if (Array.isArray(order.items) && order.items.length > 0) {
return order.items.reduce((sum: number, item: any) => {
return (order.items as Record<string, unknown>[]).reduce((sum: number, item) => {
const price = item.prix || item.price || 0;
const quantity = item.quantite || item.quantity || 1;
return sum + price * quantity;