Merge pull request 'update API Country V2' (#13) from fea/hoang-04022026-Visa/VisaDetail into main

Reviewed-on: UKSOURCE/cms.hailearning.edu.vn#13
This commit is contained in:
2026-02-04 07:21:32 +00:00

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 // 1. Lọc bỏ 'viewDetail' khỏi từng quốc gia trong danh sách
const filteredCountries = visaData.hero.summaryList.map((item) => { 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 // Tách detailedView ra, gom phần còn lại vào countryInfo
return { ...item }; 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 // 2. Gắn baseUrl vào ảnh cho danh sách đã lọc