1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-09-18 13:25:32 -04:00

more error handling

This commit is contained in:
2025-03-31 09:15:40 -04:00
parent 50c184fb21
commit ec7c9fae54
15 changed files with 114 additions and 143 deletions

View File

@@ -10,8 +10,6 @@ import type { User, Repository } from "@octokit/graphql-schema";
import styles from "./page.module.css";
export const revalidate = 600; // 10 minutes
export const metadata = addMetadata({
title: "Projects",
description: `Most-starred repositories by @${config.authorSocial?.github} on GitHub`,
@@ -80,6 +78,20 @@ const getRepos = async (): Promise<Project[] | null> => {
accept: "application/vnd.github.v3+json",
authorization: `token ${process.env.GITHUB_TOKEN}`,
},
request: {
// override fetch() to use next's extension to cache the response
// https://nextjs.org/docs/app/api-reference/functions/fetch#fetchurl-options
fetch: (url: string | URL | Request, options?: RequestInit) => {
return fetch(url, {
...options,
cache: "force-cache",
next: {
// 10 minutes
revalidate: 600,
},
});
},
},
}
);