From 16cbab790ab6ba1015dca84399bc788caf067753 Mon Sep 17 00:00:00 2001 From: andrei Date: Tue, 8 Oct 2024 12:46:37 +0500 Subject: [PATCH] ._. --- src/api.jsx | 8 +++----- src/pages/Home.jsx | 4 +++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api.jsx b/src/api.jsx index 527d92c..3d44343 100755 --- a/src/api.jsx +++ b/src/api.jsx @@ -542,14 +542,11 @@ export const getDeliveryOrderDetails = async (deliveryOrderId) => { } }; -export const calculateTotalOrder = async (deadline, robotsCount) => { +export const calculateTotalOrder = async (data) => { try { const response = await axios.post( `${API_URL}/total-orders/calculate`, - { - deadline, - robotsCount, - }, + data, { headers: { Authorization: `Bearer ${getAuthToken()}`, @@ -557,6 +554,7 @@ export const calculateTotalOrder = async (deadline, robotsCount) => { }, } ); + return response.data; } catch (error) { console.log("Ошибка при запуске расчета заказа:", error); diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index f843d08..968b274 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -67,6 +67,7 @@ const Home = () => { const handleCreateOrder = async ({ deadline, robotsCount }) => { setLoadingCreateOrder(true); try { + setShowModal(false); await calculateTotalOrder({ deadline, robotsCount }); alert("Начался расчет маршрутов. Заказ скоро появится в списке заказов."); fetchTotalOrders(); @@ -121,7 +122,8 @@ const Home = () => { onClick={() => handleToggleAccordion(order.id)} > - Заказ от {new Date(order.order_datetime).toLocaleString("ru-RU")} + Заказ от{" "} + {new Date(order.order_datetime).toLocaleString("ru-RU")} Создатель:{" "}