This commit is contained in:
Your Name committed 2026-06-21 02:16:34 -04:00
1 parent 8b73b8dd2f
commit f7ac94ca0d
5 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ const STATS = [
export default async function AboutPage({ params }: { params: Promise<{ lang: string }> }) { export default async function AboutPage({ params }: { params: Promise<{ lang: string }> }) {
const { lang } = await params; const { lang } = await params;
const res = await fetch(`${API_BASE}/settings?lang=${lang}`, { next: { revalidate: 600 } }); const res = await fetch(`${API_BASE}/settings?lang=${lang}`, { next: { revalidate: 0 } });
const settings = res.ok ? await res.json() : {}; const settings = res.ok ? await res.json() : {};
const brandName = settings?.brandName || ''; const brandName = settings?.brandName || '';
@@ -10,7 +10,7 @@ import { API_BASE } from '@/lib/api'
async function getArticle(slug: string): Promise<Article | null> { async function getArticle(slug: string): Promise<Article | null> {
try { try {
const res = await fetch(`${API_BASE}/articles/${slug}`, { next: { revalidate: 300 } }) const res = await fetch(`${API_BASE}/articles/${slug}`, { next: { revalidate: 0 } })
return res.ok ? res.json() : null return res.ok ? res.json() : null
} catch { return null } } catch { return null }
} }
@@ -19,7 +19,7 @@ type CategoryProductsResponse = {
async function getCategoryProducts(id: string, lang: string): Promise<ApiResult<CategoryProductsResponse>> { async function getCategoryProducts(id: string, lang: string): Promise<ApiResult<CategoryProductsResponse>> {
return await fetchJsonResult<CategoryProductsResponse>(`/categories/${id}/products?limit=1000&lang=${lang}`, { return await fetchJsonResult<CategoryProductsResponse>(`/categories/${id}/products?limit=1000&lang=${lang}`, {
next: { revalidate: 60 }, next: { revalidate: 0 },
}) })
} }
+1 -1
View File
@@ -41,7 +41,7 @@ export async function generateMetadata({ params }: { params: Promise<{ lang: str
} }
// Cache configuration: 0 for dev (no cache), strict numbers for production // Cache configuration: 0 for dev (no cache), strict numbers for production
const getCacheTime = (prodSeconds: number) => process.env.NODE_ENV === 'development' ? 0 : prodSeconds; const getCacheTime = (prodSeconds: number) => 0; // Temporary bypass for 5-day testing
// Fetch categories for Navbar and Footer on the server // Fetch categories for Navbar and Footer on the server
async function getCategories(lang: string) { async function getCategories(lang: string) {
+3 -3
View File
@@ -2,7 +2,7 @@ import type { Article, Category, Order, Page, Product } from '@homaroma/types'
import { API_BASE } from './api' import { API_BASE } from './api'
const isDev = process.env.NODE_ENV === 'development' const isDev = process.env.NODE_ENV === 'development'
const defaultRevalidate = isDev ? 0 : 60 const defaultRevalidate = 0
type ProductListResponse = { type ProductListResponse = {
data?: Product[] data?: Product[]
@@ -63,11 +63,11 @@ export async function fetchJsonResult<T>(path: string, init?: RequestInit & { ne
} }
export async function getCategories(lang = 'all'): Promise<Category[]> { export async function getCategories(lang = 'all'): Promise<Category[]> {
return await fetchJson<Category[]>(`/categories?lang=${lang}`, { next: { revalidate: isDev ? 0 : 3600 } }) ?? [] return await fetchJson<Category[]>(`/categories?lang=${lang}`, { next: { revalidate: 0 } }) ?? []
} }
export async function getCategoriesResult(lang = 'all'): Promise<ApiResult<Category[]>> { export async function getCategoriesResult(lang = 'all'): Promise<ApiResult<Category[]>> {
return await fetchJsonResult<Category[]>(`/categories?lang=${lang}`, { next: { revalidate: isDev ? 0 : 3600 } }) return await fetchJsonResult<Category[]>(`/categories?lang=${lang}`, { next: { revalidate: 0 } })
} }
export async function getCmsPage(slug: string, lang = 'all'): Promise<Page | null> { export async function getCmsPage(slug: string, lang = 'all'): Promise<Page | null> {