Gitlab@Informatics

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

update-address

parent 9d7def84
Branches
No related tags found
No related merge requests found
......@@ -43,13 +43,17 @@ router.get('/history', isAuthenticated, async (req, res) => {
});
// ดูรายละเอียดออเดอร์ (เฉพาะผู้ที่ Login)
router.get('/detail/:orderId', isAuthenticated, async (req, res) => {
router.get('/detail/:orderId', async (req, res) => { // ปิด isAuthenticated ชั่วคราว
console.log("Session ID:", req.session.id); // Debug Session ID
try {
const [orders] = await pool.query(
'SELECT * FROM orders WHERE id = ? AND session_id = ?',
[req.params.orderId, req.session.id]
);
console.log("Orders:", orders); // Debug Orders Query
if (orders.length === 0) {
return res.status(404).send('Order not found');
}
......@@ -57,8 +61,7 @@ router.get('/detail/:orderId', isAuthenticated, async (req, res) => {
const order = orders[0];
const [items] = await pool.query(
`SELECT
order_items.*, products.name, products.image_url
`SELECT order_items.*, products.name, products.image_url
FROM order_items
JOIN products ON order_items.product_id = products.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