diff --git a/app/cars/[type]/page.tsx b/app/cars/[type]/page.tsx index 45a2709..9fdc59c 100644 --- a/app/cars/[type]/page.tsx +++ b/app/cars/[type]/page.tsx @@ -56,10 +56,14 @@ export const generateStaticParams = () => const CarsByFuelTypePage = async ({ params, searchParams }: Props) => { const { type } = params; - const cars = await fetchApi(`${API_URL}/cars/${type}`); + const cars = await fetchApi(`${API_URL}/cars/${type}`, { + next: { tags: ["cars"] }, + }); const [months, latestMonth] = await Promise.all([ - fetchApi(`${API_URL}/months`), - fetchApi(`${API_URL}/months/latest`), + fetchApi(`${API_URL}/months`, { next: { tags: ["cars"] } }), + fetchApi(`${API_URL}/months/latest`, { + next: { tags: ["cars"] }, + }), ]); const totals = new Map(); diff --git a/app/coe/page.tsx b/app/coe/page.tsx index d57de17..4a0a3d4 100644 --- a/app/coe/page.tsx +++ b/app/coe/page.tsx @@ -18,10 +18,15 @@ import { UnreleasedFeature } from "@/components/UnreleasedFeature"; export const metadata: Metadata = { alternates: { canonical: "/coe" } }; const COEPage = async () => { - const fetchHistoricalResult = fetchApi(`${API_URL}/coe`); - const fetchMonthlyResult = fetchApi(`${API_URL}/coe/latest`); + const fetchHistoricalResult = fetchApi(`${API_URL}/coe`, { + next: { tags: ["coe"] }, + }); + const fetchMonthlyResult = fetchApi(`${API_URL}/coe/latest`, { + next: { tags: ["coe"] }, + }); const fetchLatestMonth = fetchApi>( `${API_URL}/months/latest`, + { next: { tags: ["coe"] } }, ); const [historicalResults, monthlyResults, latestMonth] = await Promise.all([ diff --git a/app/coe/prices/page.tsx b/app/coe/prices/page.tsx index 17fe0b9..7c54fe4 100644 --- a/app/coe/prices/page.tsx +++ b/app/coe/prices/page.tsx @@ -8,6 +8,7 @@ import Typography from "@/components/Typography"; const COEPricesPage = async () => { const historicalResult: COEResult[] = await fetchApi( `${API_URL}/coe?orderBy=asc`, + { next: { tags: ["coe"] } }, ); const groupedData: COEBiddingResult[] = historicalResult.reduce( diff --git a/app/make/[make]/page.tsx b/app/make/[make]/page.tsx index f642f50..6968677 100644 --- a/app/make/[make]/page.tsx +++ b/app/make/[make]/page.tsx @@ -35,7 +35,9 @@ export const generateMetadata = async ({ params, searchParams }: Props) => { }; export const generateStaticParams = async () => { - const makes = await fetchApi(`${API_URL}/make`); + const makes = await fetchApi(`${API_URL}/make`, { + next: { tags: ["cars"] }, + }); return makes.map((make) => ({ make })); }; diff --git a/utils/fetchApi.ts b/utils/fetchApi.ts index b61aa4e..6ada87a 100644 --- a/utils/fetchApi.ts +++ b/utils/fetchApi.ts @@ -1,11 +1,7 @@ -interface Options extends RequestInit {} - export const fetchApi = async ( url: string, - options: Options = {}, + options: RequestInit = {}, ): Promise => { - options = { cache: "no-store", ...options }; - const response = await fetch(url, options); if (!response.ok) {