chore: update custom-rules & update style & script data
This commit is contained in:
@@ -15,7 +15,7 @@ import type {
|
||||
DeliveryPersonDetails,
|
||||
DeliveryPersonStats,
|
||||
} from "./api_admin_types";
|
||||
const API_URL = "http://localhost:8080/api/v2";
|
||||
const API_URL = "/api/v2";
|
||||
|
||||
// ============================================
|
||||
// 🔐 TYPES - ADMIN
|
||||
@@ -825,59 +825,6 @@ export const getCommandByID = async (commandId: number) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ✅ Récupérer les items d'une commande
|
||||
*/
|
||||
export const getCommandItems = async (commandId: number) => {
|
||||
const token = sessionStorage.getItem("admin_token");
|
||||
|
||||
if (!token) {
|
||||
throw new Error("Token admin non trouvé");
|
||||
}
|
||||
|
||||
try {
|
||||
console.log("🔍 [GET_COMMAND_ITEMS] Appel:", commandId);
|
||||
|
||||
// Utiliser l'endpoint cabine qui est accessible avec le token admin
|
||||
const response = await fetch(
|
||||
`http://localhost:8080/api/v1/cabine/commands/${commandId}/items`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
console.error("❌ [GET_COMMAND_ITEMS] Erreur API:", data);
|
||||
return {
|
||||
success: false,
|
||||
items: [],
|
||||
};
|
||||
}
|
||||
|
||||
console.log("✅ [GET_COMMAND_ITEMS] Réponse:", data);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
items: data.items || [],
|
||||
count: data.count || 0,
|
||||
command_info: data.command_info,
|
||||
client_info: data.client_info,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("❌ [GET_COMMAND_ITEMS] Erreur fetch:", error);
|
||||
return {
|
||||
success: false,
|
||||
items: [],
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ✅ Mettre à jour le statut d'une commande
|
||||
*/
|
||||
@@ -2653,7 +2600,6 @@ export default {
|
||||
// Commands
|
||||
getAllCommands,
|
||||
getCommandByID,
|
||||
getCommandItems,
|
||||
getCommandCount,
|
||||
getCommandCountCompleted,
|
||||
getCommandCountInRoute,
|
||||
|
||||
Reference in New Issue
Block a user