19 lines
394 B
TypeScript
19 lines
394 B
TypeScript
import { SubstitutionData } from "./types";
|
|
|
|
export async function getData(): Promise<SubstitutionData | null> {
|
|
const apiUrl = process.env.API_URL || 'http://localhost:3000';
|
|
try {
|
|
const res = await fetch(`${apiUrl}/versioned/v3`, {
|
|
next: { revalidate: 60 },
|
|
});
|
|
|
|
if (!res.ok) {
|
|
return null;
|
|
}
|
|
|
|
return res.json();
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|