fix: blog dynamic build

This commit is contained in:
Wini_Fy
2026-02-06 12:09:33 +07:00
parent 300928ecb1
commit a9ff0e8947
8 changed files with 30 additions and 21 deletions

View File

@@ -15,10 +15,10 @@ export const aboutApi = {
try {
const apiUrl = getApiUrl();
const response = await fetch(`${apiUrl}/api/about`, {
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
headers: {
'Cache-Control': 'no-cache',
'Pragma': 'no-cache'
'Content-Type': 'application/json',
}
});
if (!response.ok) {

View File

@@ -53,9 +53,7 @@ export const fetchBlogList = async (
headers: {
'Content-Type': 'application/json',
},
// Next.js: cache và revalidate (disabled)
// next: { revalidate: 60 }, // Revalidate mỗi 60 giây
// no-cache
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
});
@@ -91,8 +89,7 @@ export const fetchBlogDetail = async (
headers: {
'Content-Type': 'application/json',
},
// No cache for blog detail (disabled caching)
// no-cache
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
});
@@ -131,8 +128,7 @@ export const fetchFeaturedBlogs = async (
headers: {
'Content-Type': 'application/json',
},
// next: { revalidate: 60 },
// no-cache
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
});
@@ -168,8 +164,7 @@ export const fetchRecentBlogs = async (
headers: {
'Content-Type': 'application/json',
},
// next: { revalidate: 60 },
// no-cache
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
});
@@ -202,8 +197,7 @@ export const fetchCategories = async (): Promise<CategoryListResponse> => {
headers: {
'Content-Type': 'application/json',
},
// next: { revalidate: 300 }, // Categories ít thay đổi, cache lâu hơn
// no-cache
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
});
@@ -239,8 +233,7 @@ export const fetchCategoryDetail = async (
headers: {
'Content-Type': 'application/json',
},
// next: { revalidate: 300 },
// no-cache
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
});
@@ -276,8 +269,7 @@ export const fetchTags = async (): Promise<TagListResponse> => {
headers: {
'Content-Type': 'application/json',
},
// next: { revalidate: 300 },
// no-cache
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
});
@@ -313,8 +305,7 @@ export const fetchPopularTags = async (
headers: {
'Content-Type': 'application/json',
},
// next: { revalidate: 300 },
// no-cache
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
});
@@ -350,8 +341,7 @@ export const fetchTagDetail = async (
headers: {
'Content-Type': 'application/json',
},
// next: { revalidate: 300 },
// no-cache
// Không cache - luôn fetch dữ liệu mới nhất
cache: 'no-store',
});

View File

@@ -138,6 +138,8 @@ export const fetchServicePageData = async (): Promise<ServicePageData> => {
headers: {
"Content-Type": "application/json",
},
// Không cache - luôn fetch dữ liệu mới nhất
cache: "no-store",
});
console.log("Services API response status:", response.status);
@@ -179,6 +181,8 @@ export const fetchServiceBySlug = async (slug: string): Promise<any> => {
headers: {
"Content-Type": "application/json",
},
// Không cache - luôn fetch dữ liệu mới nhất
cache: "no-store",
});
console.log("Response status:", response.status);