Added revalidate so it will actually pull the front page and update

This commit is contained in:
Hieuhuy Pham 2025-01-14 02:37:47 -05:00
parent 89cff766bf
commit 3fb1c6434a
2 changed files with 1 additions and 2 deletions

View File

@ -9,7 +9,6 @@ export const metadata = {
export default async function HomePage() { export default async function HomePage() {
let books: Book[] = []; let books: Book[] = [];
try { try {
books = await fetchBooks(); books = await fetchBooks();
} catch (error) { } catch (error) {

View File

@ -26,7 +26,7 @@ export async function fetchFromAPI<T>(
}; };
try { try {
const response = await fetch(url, config); const response = await fetch(url, {...config, next: {revalidate:30}});
if (!response.ok) { if (!response.ok) {
const errorData = await response.json(); const errorData = await response.json();
console.error(`Error fetching ${url}:`, errorData); console.error(`Error fetching ${url}:`, errorData);