Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit 3d69bd48 authored by 65160381's avatar 65160381
Browse files

9.5

parent 3970b8e3
No related branches found
No related tags found
No related merge requests found
Pipeline #621 passed with warnings
......@@ -125,7 +125,15 @@ app.post('/login', async (req, res) => {
}
});
app.get('/api/getUser', (req, res) => {
if (req.session.user) {
res.json({
email: req.session.user.email // ส่งข้อมูล email จาก session
});
} else {
res.status(401).send('User not logged in');
}
});
// Fetch products of logged-in user
app.get('/api/user/products', (req, res) => {
......
......@@ -121,6 +121,9 @@
}
}
// เรียกใช้ฟังก์ชันเมื่อหน้าเว็บโหลดเสร็จ
window.onload = displayUsername;
// Initially load products, cart item count, and user info
fetchProducts(); // Fetch all products initially
updateCart(); // Update cart count when page loads
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment