Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit e0dbcf28 authored by 65160270's avatar 65160270
Browse files

update-address

parent e717861b
No related branches found
No related tags found
No related merge requests found
...@@ -43,17 +43,13 @@ router.get('/history', isAuthenticated, async (req, res) => { ...@@ -43,17 +43,13 @@ router.get('/history', isAuthenticated, async (req, res) => {
}); });
// ดูรายละเอียดออเดอร์ (เฉพาะผู้ที่ Login) // ดูรายละเอียดออเดอร์ (เฉพาะผู้ที่ Login)
router.get('/detail/:orderId', async (req, res) => { // ปิด isAuthenticated ชั่วคราว router.get('/detail/:orderId', async (req, res) => {
console.log("Session ID:", req.session.id); // Debug Session ID
try { try {
const [orders] = await pool.query( const [orders] = await pool.query(
'SELECT * FROM orders WHERE id = ? AND session_id = ?', 'SELECT * FROM orders WHERE id = ? AND session_id = ?',
[req.params.orderId, req.session.id] [req.params.orderId, req.session.id]
); );
console.log("Orders:", orders); // Debug Orders Query
if (orders.length === 0) { if (orders.length === 0) {
return res.status(404).send('Order not found'); return res.status(404).send('Order not found');
} }
...@@ -61,7 +57,8 @@ router.get('/detail/:orderId', async (req, res) => { // ปิด isAuthenticat ...@@ -61,7 +57,8 @@ router.get('/detail/:orderId', async (req, res) => { // ปิด isAuthenticat
const order = orders[0]; const order = orders[0];
const [items] = await pool.query( const [items] = await pool.query(
`SELECT order_items.*, products.name, products.image_url `SELECT
order_items.*, products.name, products.image_url
FROM order_items FROM order_items
JOIN products ON order_items.product_id = products.id JOIN products ON order_items.product_id = products.id
WHERE order_items.order_id = ?`, WHERE order_items.order_id = ?`,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment