Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/controllers/authController.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const loginUser = async (req, res) => {
}

// Generate JWT
const token = generateToken(user._id);
const token = generateToken(user._id);

// Set JWT in secure, HTTP-only cookie
res.cookie('token', token, {
Expand Down
2 changes: 1 addition & 1 deletion backend/controllers/paymentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const createOrder = async (req, res) => {
res.status(200).json({
success: true,
orderId: order.id,
amount: order.amount,
amount: order.amount,
currency: order.currency,
});
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@mui/material": "^7.3.2",
"axios": "^1.11.0",
"axios": "^1.12.1",
"gsap": "^3.13.0",
"html2pdf.js": "^0.10.3",
"leaflet": "^1.9.4",
Expand Down
115 changes: 115 additions & 0 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ import ScrollToBottom from "./components/ScrollToBottomButton/ScrollToBottomButt
import ReferralProgram from "./components/Referrals/ReferralProgram";
import AboutUs from "./components/Aboutus/Aboutus";
import FAQ from "./components/FAQ/FAQ";
import MyProfile from "./pages/MyProfile/MyProfile";
import MyOrder from "./pages/MyOrder/MyOrder";
import ConfirmOrder from "./pages/ConfirmOrder.jsx/ConfirmOrder";
import Payment from "./pages/Payment/Payment";
import OrderSuccess from "./pages/OrderSuccess/OrderSuccess";
import Privacy from "./components/Privacy/privacy";
import FeedbackReviews from "./components/FeedbackReviews/FeedbackReviews";

Expand Down Expand Up @@ -96,6 +101,116 @@ const App = () => {
<Route path="/referral" element={<ReferralProgram />} />
<Route path="/restaurant/:id" element={<RestaurantDetail />} />
<Route path="/aboutus" element={<AboutUs />} />
<Route
path="/profile/me"
element={
isLoggedIn ? (<MyProfile />) : (
<div style={{ padding: "2rem", textAlign: "center" }}>
<h2
style={{
color: "#f97316", // Tailwind's orange-500
fontSize: "2rem",
fontWeight: "bold",
textShadow: "1px 1px 2px rgba(0,0,0,0.2)",
marginBottom: "0.5rem",
}}
>
Please Log In To Proceed
</h2>
<p style={{ color: "#fdba74", fontSize: "1rem" }}>
Your journey continues after login ๐Ÿ”
</p>
</div>
)
} />
<Route
path="/orders/me"
element={
isLoggedIn ? (<MyOrder />) : (
<div style={{ padding: "2rem", textAlign: "center" }}>
<h2
style={{
color: "#f97316", // Tailwind's orange-500
fontSize: "2rem",
fontWeight: "bold",
textShadow: "1px 1px 2px rgba(0,0,0,0.2)",
marginBottom: "0.5rem",
}}
>
Please Log In To Proceed
</h2>
<p style={{ color: "#fdba74", fontSize: "1rem" }}>
Your journey continues after login ๐Ÿ”
</p>
</div>
)
} />
<Route
path="/order/confirm"
element={
isLoggedIn ? (<ConfirmOrder/>) : (
<div style={{ padding: "2rem", textAlign: "center" }}>
<h2
style={{
color: "#f97316", // Tailwind's orange-500
fontSize: "2rem",
fontWeight: "bold",
textShadow: "1px 1px 2px rgba(0,0,0,0.2)",
marginBottom: "0.5rem",
}}
>
Please Log In To Proceed
</h2>
<p style={{ color: "#fdba74", fontSize: "1rem" }}>
Your journey continues after login ๐Ÿ”
</p>
</div>
)
}/>
<Route
path="/order/payment"
element={
isLoggedIn ? (<Payment/>) : (
<div style={{ padding: "2rem", textAlign: "center" }}>
<h2
style={{
color: "#f97316", // Tailwind's orange-500
fontSize: "2rem",
fontWeight: "bold",
textShadow: "1px 1px 2px rgba(0,0,0,0.2)",
marginBottom: "0.5rem",
}}
>
Please Log In To Proceed
</h2>
<p style={{ color: "#fdba74", fontSize: "1rem" }}>
Your journey continues after login ๐Ÿ”
</p>
</div>
)
}/>
<Route
path="/order/Success"
element={
isLoggedIn ? (<OrderSuccess/>) : (
<div style={{ padding: "2rem", textAlign: "center" }}>
<h2
style={{
color: "#f97316", // Tailwind's orange-500
fontSize: "2rem",
fontWeight: "bold",
textShadow: "1px 1px 2px rgba(0,0,0,0.2)",
marginBottom: "0.5rem",
}}
>
Please Log In To Proceed
</h2>
<p style={{ color: "#fdba74", fontSize: "1rem" }}>
Your journey continues after login ๐Ÿ”
</p>
</div>
)
}/>
<Route path="/privacy" element={<Privacy />} />
<Route path="*" element={<NotFound />} />
</Routes>
Expand Down
30 changes: 16 additions & 14 deletions frontend/src/components/LoginPopup/LoginPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ const LoginPopup = ({ setShowLogin }) => {
const handleResetPassword = (e) => {
e.preventDefault();
if (newPassword !== confirmPassword) return toast.error("Passwords do not match");
toast.success("Password reset successfully!");
setForgotFlow(false);
setStage(1);
setOtp(Array(6).fill(""));
setCurrState("Login");
};
const handleSubmit = async (e) => {
toast.success("Password reset successfully!");
setForgotFlow(false);
setStage(1);
setOtp(Array(6).fill(""));
setCurrState("Login");
};
const handleSubmit = async (e) => {
e.preventDefault();

const formData = new FormData(e.target);
Expand All @@ -148,8 +148,8 @@ const LoginPopup = ({ setShowLogin }) => {
const confirmPassword = formData.get("confirmPassword");

if (!email || !password || (currState === "Sign Up" && !name)) {
return toast.error("Please fill all fields");
}
return toast.error("Please fill all fields");
}

if (currState === "Sign Up" && password !== confirmPassword) {
return toast.error("Passwords do not match");
Expand All @@ -159,15 +159,17 @@ const LoginPopup = ({ setShowLogin }) => {
currState === "Sign Up" ? "/api/auth/register" : "/api/auth/login";

try {
const { data } = await apiRequest.post(endpoint, { name, email, password });
const { data } = await apiRequest.post(endpoint, { name, email, password }, {
headers: { "Content-Type": "application/json" },
withCredentials: true
});

toast.success(`${currState} successful!`);

// Store user info and auth token locally
// Store user info locally (no token)
localStorage.setItem("authToken", data.token);
localStorage.setItem("user", JSON.stringify(data.user));
if (data.token) {
localStorage.setItem("authToken", data.token);
}


setShowLogin(false);
window.location.reload();
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/components/Navbar/Navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ body {
flex: 0 0 auto;
display: flex;
align-items: center;
gap: 1rem;
gap: 0.5rem;
/* gap: 10px; */
/* margin-right: 10px; */
}
.menu-item{
display:flex;
align-items: center;
gap:0.5vmax;
}

/* ACTION BUTTONS */
Expand Down
Loading