mirror of
https://github.com/TheRealOwenRees/echecsfrance.git
synced 2026-07-23 04:26:57 +00:00
env variables changes
This commit is contained in:
@@ -16,7 +16,7 @@ const useTournamentDataFilter = (
|
||||
|
||||
if (filtered.length === 0) {
|
||||
state = (
|
||||
<tr className="border-b border-gray-700 border-opacity-20 bg-gray-800 text-white">
|
||||
<tr className="bg-white text-gray-900 dark:bg-gray-800 dark:text-white">
|
||||
<td colSpan={4} className="p-3">
|
||||
No tournaments found
|
||||
</td>
|
||||
|
||||
@@ -3,11 +3,16 @@
|
||||
* @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 baseUrl =
|
||||
process.env.NODE_ENV === "production"
|
||||
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
|
||||
: "http://localhost:3000";
|
||||
const res = await fetch(`${baseUrl}/api/tournaments/${country}`, {
|
||||
next: { revalidate: 300 },
|
||||
});
|
||||
return await res.json();
|
||||
|
||||
if (res.status !== 200) {
|
||||
throw new Error("Failed to fetch tournament data");
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user