Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit c564a9db authored by 65160394's avatar 65160394
Browse files

Project Round 8

parent 3670d022
No related branches found
No related tags found
No related merge requests found
......@@ -211,10 +211,14 @@ exports.postEditTour = async (req, res) => {
}
const tourData = { name, description, price, duration };
const tourId = req.params.userId;
if (!tourId) {
return res.status(400).send('ไม่พบข้อมูลทัวร์');
}
try {
await Tour.updateTour(id, tourData);
res.redirect('/tour/' + req.params.id); // ไปที่หน้ารายละเอียดทัวร์
await Tour.updateTour(tourId, tourData);
res.redirect('/tour/' + tourId); // ไปที่หน้ารายละเอียดทัวร์
} catch (error) {
console.error('Error updating tour:', error); // ข้อผิดพลาด
res.status(500).send('เกิดข้อผิดพลาดในการแก้ไขทัวร์');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment