forked from UKSOURCE/hailearning.edu.vn
Merge pull request 'fea/thanh-02022026-news' (#12) from fea/thanh-02022026-news into main
Reviewed-on: UKSOURCE/hailearning.edu.vn#12
This commit is contained in:
@@ -53,8 +53,10 @@ export const fetchBlogList = async (
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
// Next.js: cache và revalidate
|
||||
next: { revalidate: 60 }, // Revalidate mỗi 60 giây
|
||||
// Next.js: cache và revalidate (disabled)
|
||||
// next: { revalidate: 60 }, // Revalidate mỗi 60 giây
|
||||
// no-cache
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -89,7 +91,8 @@ export const fetchBlogDetail = async (
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
// No cache for blog detail so comments/replies show immediately after submit + refresh
|
||||
// No cache for blog detail (disabled caching)
|
||||
// no-cache
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
@@ -128,7 +131,9 @@ export const fetchFeaturedBlogs = async (
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
next: { revalidate: 60 },
|
||||
// next: { revalidate: 60 },
|
||||
// no-cache
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -163,7 +168,9 @@ export const fetchRecentBlogs = async (
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
next: { revalidate: 60 },
|
||||
// next: { revalidate: 60 },
|
||||
// no-cache
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -195,7 +202,9 @@ export const fetchCategories = async (): Promise<CategoryListResponse> => {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
next: { revalidate: 300 }, // Categories ít thay đổi, cache lâu hơn
|
||||
// next: { revalidate: 300 }, // Categories ít thay đổi, cache lâu hơn
|
||||
// no-cache
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -230,7 +239,9 @@ export const fetchCategoryDetail = async (
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
next: { revalidate: 300 },
|
||||
// next: { revalidate: 300 },
|
||||
// no-cache
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -265,7 +276,9 @@ export const fetchTags = async (): Promise<TagListResponse> => {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
next: { revalidate: 300 },
|
||||
// next: { revalidate: 300 },
|
||||
// no-cache
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -300,7 +313,9 @@ export const fetchPopularTags = async (
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
next: { revalidate: 300 },
|
||||
// next: { revalidate: 300 },
|
||||
// no-cache
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -335,7 +350,9 @@ export const fetchTagDetail = async (
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
next: { revalidate: 300 },
|
||||
// next: { revalidate: 300 },
|
||||
// no-cache
|
||||
cache: 'no-store',
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
@@ -1,4 +1,4 @@
|
||||
/**
|
||||
* Export all API functions
|
||||
*/
|
||||
export * from './blog';
|
||||
export * from './blogsApi';
|
||||
|
||||
Reference in New Issue
Block a user