diff --git a/Frontend/src/pages/UserPanel/AddFarm.jsx b/Frontend/src/pages/UserPanel/AddFarm.jsx deleted file mode 100644 index 9b5d6a3..0000000 --- a/Frontend/src/pages/UserPanel/AddFarm.jsx +++ /dev/null @@ -1,225 +0,0 @@ -import React, { useState } from "react"; -import { useNavigate } from "react-router-dom"; - -const AddFarm = () => { - const [isModalOpen, setIsModalOpen] = useState(false); - const [farmName, setFarmName] = useState(""); - const [location, setLocation] = useState(""); - const [waterContent, setWaterContent] = useState(""); - const [soilType, setSoilType] = useState(""); - const [error, setError] = useState(null); - const [success, setSuccess] = useState(false); - const navigate = useNavigate(); - - const handleSubmit = async (e) => { - e.preventDefault(); - const farmData = { - name: farmName, - location, - waterContent, - soilType, - }; - - try { - const response = await fetch("http://localhost:8000/api/v1/farm", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(farmData), - }); - - if (!response.ok) { - throw new Error("Failed to add farm"); - } - - setSuccess(true); - setError(null); - setIsModalOpen(false); - navigate("/dashboard"); - } catch (err) { - setError(err.message); - setSuccess(false); - } - }; - - return ( - <> - - - {isModalOpen && ( -