From 30655dc5a89ccb86cd477a1e47447e9121ae9e7c Mon Sep 17 00:00:00 2001 From: dasha Date: Mon, 10 Apr 2023 15:37:07 +0400 Subject: [PATCH] order add feature --- front/src/pages/Orders.jsx | 23 +++++++++++++++++++ .../src/pages/components/OrderSessionItem.jsx | 2 ++ .../com/labwork1/app/WebConfiguration.java | 23 +++++++++++++++++++ .../student/controller/OrderController.java | 4 +++- 4 files changed, 51 insertions(+), 1 deletion(-) diff --git a/front/src/pages/Orders.jsx b/front/src/pages/Orders.jsx index dffc089..e8baaf6 100644 --- a/front/src/pages/Orders.jsx +++ b/front/src/pages/Orders.jsx @@ -97,6 +97,7 @@ export default function Orders() { }) .catch((error) => { console.error('Error:', error); + alert('Не хватает билетов на сеанс') }); }; @@ -139,6 +140,27 @@ export default function Orders() { .catch(e => { console.log('Error get orders') }) } + async function handleDeleteOrderSession(id, sessionId) { + console.info('Start delete session'); + console.info(id+'-order, session-'+sessionId) + const requestParams = { + method: "PUT", + headers: { + "Content-Type": "application/json" + } + }; + const requestUrl = `http://localhost:8080/order/${id}?session=${sessionId}` + const response = await fetch(requestUrl, requestParams) + await response.json() + .then((data) => { + console.info('End delete session') + setOrderSessions(data.sessions) + }) + .catch((error) => { + console.error('Error:', error); + }); + } + const Content = ( <>