forked from UKSOURCE/cms.hailearning.edu.vn
fix: on/off tab in home page
This commit is contained in:
@@ -445,14 +445,11 @@ exports.apiGetBlogs = async (req, res) => {
|
||||
};
|
||||
exports.api = async (req, res) => {
|
||||
try {
|
||||
const docs = await getAllHomeDocs();
|
||||
let data = docs[0]?.toObject() || {};
|
||||
// Chỉ dùng doc mới nhất, không merge nhiều docs
|
||||
const doc = await getHomeDoc();
|
||||
let data = doc?.toObject() || {};
|
||||
const baseUrl = `${req.protocol}://${req.get("host")}`;
|
||||
|
||||
if (docs.length > 1) {
|
||||
data.hero = getPreferredHeroData(docs.map((doc) => doc.toObject()));
|
||||
}
|
||||
|
||||
// === Xử lý Blog Preview động ===
|
||||
const blogPreview = data.blogPreview || {};
|
||||
let blogs = [];
|
||||
|
||||
Reference in New Issue
Block a user