From 8d38b6db567d1e45ef9a8655720893f9c76978d3 Mon Sep 17 00:00:00 2001 From: r2xrzh9q2z-lab Date: Wed, 4 Feb 2026 13:57:23 +0700 Subject: [PATCH] update API Country --- controllers/visaController.js | 5 ++--- routes/admin.js | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/controllers/visaController.js b/controllers/visaController.js index d68af90..ddd9029 100644 --- a/controllers/visaController.js +++ b/controllers/visaController.js @@ -504,9 +504,8 @@ exports.apiCountries = async (req, res) => { // 1. Lọc bỏ 'viewDetail' khỏi từng quốc gia trong danh sách const filteredCountries = visaData.hero.summaryList.map((item) => { - // Dùng destructuring để tách viewDetail ra và gom phần còn lại vào countryInfo - const { detailedView, ...countryInfo } = item; - return countryInfo; + // Trả về bản sao của item để giữ nguyên cấu trúc gốc bao gồm cả detailedView + return { ...item }; }); // 2. Gắn baseUrl vào ảnh cho danh sách đã lọc diff --git a/routes/admin.js b/routes/admin.js index 2901ad5..3339dc3 100644 --- a/routes/admin.js +++ b/routes/admin.js @@ -480,8 +480,6 @@ router.get("/visa", ensureAuthenticated, visaController.index); // Get country data for editing router.get("/visa/edit/:id", ensureAuthenticated, visaController.getCountry); -router.get("/visa/country", visaController.apiCountries); - // Update hero title router.post("/visa/update", ensureAuthenticated, visaController.update);