forked from UKSOURCE/cms.hailearning.edu.vn
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user