From 712ded405cfa48720f9ee329f6eae739707bdba2 Mon Sep 17 00:00:00 2001 From: Saksham2k3s Date: Thu, 4 Jul 2024 02:50:33 +0800 Subject: [PATCH] Solved issue 393 --- src/pages/AddFoodItem.jsx | 3 +- src/pages/EditProfile.jsx | 66 +++++++++++++++++++++++++-------------- src/pages/Login.jsx | 2 +- src/pages/SectionPage.jsx | 2 ++ src/pages/Signup.jsx | 4 ++- 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/src/pages/AddFoodItem.jsx b/src/pages/AddFoodItem.jsx index 8264ef8..86b5b16 100644 --- a/src/pages/AddFoodItem.jsx +++ b/src/pages/AddFoodItem.jsx @@ -60,6 +60,7 @@ function AddFoodItem() { break; case "Dinner": apiUrl = `${process.env.REACT_APP_BASE_URL}/${canteenId}/dinner/add`; + console.log("This is api url",apiUrl); break; default: toast.error("Please select a meal type."); @@ -103,7 +104,7 @@ function AddFoodItem() { }; return ( -
+
{ const { _id } = useParams(); // Assuming you have canteen ID in the URL const navigate = useNavigate(); // useNavigate hook for navigation const [edit, setEditable] = useState(false); + const [editName, setEditName] = useState(false); + const [editEmail, setEditEmail] = useState(false); + const [editCollegeName, setEditCollegeName] = useState(false); + const [editImage, setEditImage] = useState(false); const [formData, setFormData] = useState({ name: '', email: '', @@ -93,12 +98,13 @@ const EditProfile = () => { return ( <> -
+

Edit Profile

@@ -106,52 +112,64 @@ const EditProfile = () => { - + + setEditName(!editName)} /> +
- + + setEditEmail(!editEmail)} /> +
- + + setEditCollegeName(!editCollegeName)} /> +
- + + setEditImage(!editImage)} /> +
{formData.canteenImage ? ( Canteen ) : ( @@ -159,7 +177,7 @@ const EditProfile = () => { )}
- {!edit && ( + {/* {!edit && ( - )} - {edit && ( + )} */} + <> - )}
diff --git a/src/pages/Login.jsx b/src/pages/Login.jsx index 7d03006..773752c 100644 --- a/src/pages/Login.jsx +++ b/src/pages/Login.jsx @@ -59,7 +59,7 @@ function Login() { const apiUrl = formData.accountType === "User" - ? 'http://localhost:4000/api/v1/studentLogin' : 'http://localhost:4000/api/v1/canteenLogin' + ? 'http://localhost:8000/api/v1/studentLogin' : 'http://localhost:8000/api/v1/canteenLogin' diff --git a/src/pages/SectionPage.jsx b/src/pages/SectionPage.jsx index 7589ec2..3076897 100644 --- a/src/pages/SectionPage.jsx +++ b/src/pages/SectionPage.jsx @@ -116,7 +116,9 @@ const SectionPage = () => { Product List +
{view === "add" ? : } +
)} diff --git a/src/pages/Signup.jsx b/src/pages/Signup.jsx index b6f6204..c30b3c1 100644 --- a/src/pages/Signup.jsx +++ b/src/pages/Signup.jsx @@ -66,7 +66,7 @@ function Signup() { // : `${process.env.REACT_APP_BASE_URL}/canteenSignup`; const apiUrl = formData.accountType === "User" - ? 'http://localhost:4000/api/v1/studentSignup' : 'http://localhost:4000/api/v1/canteenSignup' + ? 'http://localhost:8000/api/v1/studentSignup' : 'http://localhost:8000/api/v1/canteenSignup' @@ -74,6 +74,8 @@ function Signup() { setLoading(true); const response = await axios.post(apiUrl, formData); + + console.log("This is response", response.data); toast.success("Account Created Successfully!");