chore: build
This commit is contained in:
+18
-9
@@ -420,10 +420,6 @@ export const respondToAddressProposal = async (
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// TRACKING
|
||||
// ============================================
|
||||
|
||||
export const getOrderTracking = async (
|
||||
commandId: number,
|
||||
): Promise<TrackingResponse> => {
|
||||
@@ -984,7 +980,10 @@ export const getMyPointsRewards = async (): Promise<{
|
||||
}
|
||||
};
|
||||
|
||||
export const claimMyReward = async (poolKey: string, productId?: number): Promise<{
|
||||
export const claimMyReward = async (
|
||||
poolKey: string,
|
||||
productId?: number,
|
||||
): Promise<{
|
||||
success: boolean;
|
||||
description?: string;
|
||||
remaining_rewards?: number;
|
||||
@@ -993,7 +992,9 @@ export const claimMyReward = async (poolKey: string, productId?: number): Promis
|
||||
error?: string;
|
||||
}> => {
|
||||
try {
|
||||
const body: { pool_key: string; product_id?: number } = { pool_key: poolKey };
|
||||
const body: { pool_key: string; product_id?: number } = {
|
||||
pool_key: poolKey,
|
||||
};
|
||||
if (productId !== undefined) body.product_id = productId;
|
||||
const { data } = await apiClient.post(`${V1}/points/claim`, body);
|
||||
return {
|
||||
@@ -1014,7 +1015,10 @@ export const submitLivreurRating = async (
|
||||
comment: string,
|
||||
): Promise<{ success: boolean; error?: string }> => {
|
||||
try {
|
||||
await apiClient.post(`${V1}/orders/${orderId}/rate`, { rating, comment });
|
||||
await apiClient.post(`${V1}/orders/${orderId}/rate`, {
|
||||
rating,
|
||||
comment,
|
||||
});
|
||||
return { success: true };
|
||||
} catch (e: any) {
|
||||
return { success: false, error: e?.response?.data?.error || "Erreur" };
|
||||
@@ -1033,11 +1037,16 @@ export const getOrderRatingStatus = async (
|
||||
};
|
||||
|
||||
export const calculateOrderTotal = (order: any): number => {
|
||||
if (typeof order.total_prix === "number" && order.total_prix > 0) return order.total_prix;
|
||||
if (typeof order.total_prix === "number" && order.total_prix > 0)
|
||||
return order.total_prix;
|
||||
if (typeof order.total === "number" && order.total > 0) return order.total;
|
||||
if (Array.isArray(order.items) && order.items.length > 0) {
|
||||
return order.items.reduce((sum: number, item: any) => {
|
||||
return sum + (item.prix || item.price || 0) * (item.quantite || item.quantity || 1);
|
||||
return (
|
||||
sum +
|
||||
(item.prix || item.price || 0) *
|
||||
(item.quantite || item.quantity || 1)
|
||||
);
|
||||
}, 0);
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user