chore: update
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
// ============================================
|
||||
// pages/OrderDetails.tsx
|
||||
// ============================================
|
||||
// Page de détails d'une commande spécifique
|
||||
// ✅ AJOUT: Vérification continue de l'authentification
|
||||
|
||||
import { useState, useEffect } from "react";
|
||||
import { useParams, useNavigate } from "react-router-dom";
|
||||
import Navbar from "../../components/Navbar";
|
||||
@@ -251,7 +245,6 @@ function OrderDetails() {
|
||||
}, [order?.products]);
|
||||
|
||||
const fetchOrderDetails = async (id: number) => {
|
||||
// ✅ Vérifier l'auth avant de charger les détails
|
||||
if (!isUserAuthenticated()) {
|
||||
console.log("❌ [fetchOrderDetails] Non authentifié");
|
||||
navigate("/login/client", { replace: true });
|
||||
@@ -276,6 +269,8 @@ function OrderDetails() {
|
||||
const orderData: OrderDetailsData = {
|
||||
// Infos de command_info
|
||||
id: apiData.command_info?.id || id,
|
||||
client_order_number:
|
||||
apiData.command_info?.client_order_number || 0,
|
||||
username: apiData.client_info?.username || "",
|
||||
status: apiData.command_info?.command_status || "unknown",
|
||||
adresse: apiData.command_info?.command_address || "",
|
||||
@@ -302,11 +297,11 @@ function OrderDetails() {
|
||||
id: item.id,
|
||||
product_id: item.product_id,
|
||||
name_product: item.produit,
|
||||
category: "Non spécifié", // Pas de catégorie dans command_items
|
||||
category: "Non spécifié",
|
||||
price: item.prix,
|
||||
quantity: item.quantite,
|
||||
status: item.status,
|
||||
image: item.image, // Si vous avez des images
|
||||
image: item.image,
|
||||
})) || [],
|
||||
};
|
||||
|
||||
@@ -390,7 +385,10 @@ function OrderDetails() {
|
||||
</button>
|
||||
<div className="header-info">
|
||||
<h1 className="order-number">
|
||||
Commande #{order.id.toString().padStart(5, "0")}
|
||||
Commande #
|
||||
{(order.client_order_number ?? 0)
|
||||
.toString()
|
||||
.padStart(4, "0")}
|
||||
</h1>
|
||||
<div className="status-container">
|
||||
<span className="status-badge delivered">
|
||||
|
||||
Reference in New Issue
Block a user