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;
+10 -1
View File
@@ -19,6 +19,7 @@ export interface ApiResponse {
token_type?: string;
expires_in?: number;
user?: UserResponse;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any; // Pour les champs additionnels
}
@@ -258,6 +259,7 @@ export interface OrderDetail {
// Métadonnées
payment_method?: string;
notes?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
@@ -352,6 +354,7 @@ export interface TrackingResponse {
updated_at?: number;
created_at?: string;
message?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
@@ -379,6 +382,7 @@ export interface Product {
}>;
created_at?: string;
updated_at?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
@@ -388,6 +392,7 @@ export interface ProductsResponse {
data?: Product[];
products?: Product[];
count?: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
@@ -429,6 +434,7 @@ export interface JWTPayload {
iat: number;
exp: number;
iss: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
@@ -445,6 +451,7 @@ export interface ErrorResponse {
message?: string;
details?: string;
status_code?: number;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
@@ -607,6 +614,7 @@ export interface ETAResponse {
eta_available?: boolean;
livreur_distance?: number;
message?: string;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
}
@@ -767,6 +775,7 @@ export interface ConfirmReceptionResponse {
data?: {
category?: string;
points_earned?: number;
[key: string]: any;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
};
}