From 3cd1a9c1e4aa860f926efe45b0785760b3e7bf20 Mon Sep 17 00:00:00 2001 From: Oleg Urin Date: Mon, 24 Nov 2025 02:37:32 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D1=83=20=D0=BE=D1=82=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=D0=BA=D0=B8=20=D1=84=D0=BE=D1=80=D0=BC=D1=8B=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B1=D1=8D=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/PriceLisForm/PriceLisForm.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/front/src/components/PriceLisForm/PriceLisForm.tsx b/front/src/components/PriceLisForm/PriceLisForm.tsx index d7c04e7..88518bc 100644 --- a/front/src/components/PriceLisForm/PriceLisForm.tsx +++ b/front/src/components/PriceLisForm/PriceLisForm.tsx @@ -6,6 +6,7 @@ import * as yup from "yup"; import { yupResolver } from "@hookform/resolvers/yup"; import styles from "./ModalRequestForm.module.css"; import Button from "../Button/Button"; +import axios from "axios"; // ✅ Схема валидации const schema = yup.object().shape({ @@ -60,7 +61,19 @@ const PriceLisForm: React.FC = ({ open, onClose }) => { }; const sendToBackend = async (data: FormData): Promise => { - return true; + try{ + const response = await axios.post("/api/requests", { + ...data, + source: "website-form", + timestamp: new Date().toISOString(), + }) + + return response.data.success; + }catch (error: any){ + console.error("Error sending request:", error); + + throw new Error("Не удалось отправить заявку. Попробуйте позже."); + } }; const onSubmit = async (data: FormData) => {