x
This commit is contained in:
1 parent
8b73b8dd2f
commit
f7ac94ca0d
5 files changed
+7
-7
No files matched your search
@@ -2,7 +2,7 @@ import type { Article, Category, Order, Page, Product } from '@homaroma/types'
|
||||
import { API_BASE } from './api'
|
||||
|
||||
const isDev = process.env.NODE_ENV === 'development'
|
||||
const defaultRevalidate = isDev ? 0 : 60
|
||||
const defaultRevalidate = 0
|
||||
|
||||
type ProductListResponse = {
|
||||
data?: Product[]
|
||||
@@ -63,11 +63,11 @@ export async function fetchJsonResult<T>(path: string, init?: RequestInit & { ne
|
||||
}
|
||||
|
||||
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[]>> {
|
||||
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> {
|
||||
|
||||
Reference in new issue
Block a user