update API Country V2

This commit is contained in:
r2xrzh9q2z-lab
2026-02-04 14:20:24 +07:00
parent aa92331f04
commit 5bf6226df7

View File

@@ -504,8 +504,14 @@ 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) => {
// Trả về bản sao của item để giữ nguyên cấu trúc gốc bao gồm cả detailedView
return { ...item };
// Tách detailedView ra, gom phần còn lại vào countryInfo
const { detailedView, ...countryInfo } = item;
return {
...countryInfo,
// Lấy mainImage từ sâu bên trong detailedView và gán vào key mới
mainImage: detailedView?.activeCountry?.mainImage || "",
};
});
// 2. Gắn baseUrl vào ảnh cho danh sách đã lọc