mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
14 lines
453 B
TypeScript
14 lines
453 B
TypeScript
/**
|
|
* Retrieves tournament data from /api/tournaments/:country
|
|
* @remarks The result is cached for the revalidation period in seconds
|
|
*/
|
|
export default async function getTournaments(country: string) {
|
|
const baseUrl = process.env.VERCEL_URL
|
|
? `https://${process.env.VERCEL_URL}`
|
|
: "http://localhost:3000";
|
|
const res = await fetch(`${baseUrl}/api/tournaments/${country}`, {
|
|
next: { revalidate: 300 },
|
|
});
|
|
return await res.json();
|
|
}
|