chore: update custom-rules & update style & script data
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
// ✅ loginUser et registerUser retournent AuthResponse
|
||||
// ✅ sessionStorage (pas localStorage)
|
||||
|
||||
const API_URL = "http://localhost:8080/api/v1";
|
||||
const API_URL = "/api/v1";
|
||||
import type {
|
||||
ConfirmReceptionResponse,
|
||||
CheckoutCartResponse,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// ✅ Utilise /api/v1/cabine/* endpoints uniquement
|
||||
// ✅ sessionStorage pour la persistance
|
||||
|
||||
const API_URL = "http://localhost:8080/api/v1/cabine";
|
||||
const API_URL = "/api/v1/cabine";
|
||||
import type {
|
||||
DeliveryPerson,
|
||||
DeliveryPersonsStats,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// ✅ Fonctions helper pour le dashboard livreur
|
||||
// ✅ Utilise /api/v1/livreur/* endpoints
|
||||
|
||||
const API_URL = "http://localhost:8080/api/v1/livreur";
|
||||
const API_URL = "/api/v1/livreur";
|
||||
|
||||
// ============================================
|
||||
// 🔐 TYPES - LIVREUR
|
||||
|
||||
Reference in New Issue
Block a user