chore: fix

This commit is contained in:
2026-05-03 19:44:35 +02:00
parent f8473b9a54
commit 37ae4117b4
5 changed files with 37 additions and 20 deletions
+10 -10
View File
@@ -21,6 +21,7 @@ import type {
ETAResponse,
TrackingResponse,
OrderDetail,
OrderItem,
CancelCommandResponse,
} from "../../api/api_types";
import Navbar from "../../components/Navbar";
@@ -110,12 +111,11 @@ const getDeliveryAddress = (order: OrderWithTracking): string => {
return order.delivery_address || order.adresse || "Non disponible";
};
const formatOrderItem = (item: Record<string, unknown>) => {
const formatOrderItem = (item: OrderItem) => {
return {
name:
item.produit || item.product_name || item.name_product || "Produit",
quantity: item.quantite || item.quantity || 0, // Grammes
price: item.prix || item.price || 0,
name: String(item.produit || item.product_name || item.name_product || "Produit"),
quantity: Number(item.quantite || item.quantity || 0),
price: Number(item.prix || item.price || 0),
};
};
@@ -187,9 +187,9 @@ const calculateOrderPoints = (
let excludedTotal = 0;
if (order.items && order.items.length > 0) {
order.items.forEach((item: Record<string, unknown>) => {
const cat = (item.category || "").toLowerCase();
const itemPrice = item.prix || item.price || 0;
order.items.forEach((item: OrderItem) => {
const cat = String(item.category || "").toLowerCase();
const itemPrice = Number(item.prix || item.price || 0);
if (cat.includes("gros") || cat.includes("semi")) {
excludedTotal += itemPrice;
@@ -464,7 +464,7 @@ function SuiviLivraison() {
const pointsEarned =
response.points_earned || selectedOrderPoints;
const apiCategory =
response.category || (response as Record<string, unknown> & { data?: { category?: string } }).data?.category || "";
response.category || response.data?.category || "";
const displayCategory =
apiCategory && apiCategory !== "total"
@@ -898,7 +898,7 @@ function SuiviLivraison() {
<div className="items-list">
{order.items.map(
(
item: Record<string, unknown>,
item: OrderItem,
idx: number,
) => {
const formatted =