1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-03 18:06:38 -04:00

fix sitemap.xml timeouts

This commit is contained in:
2022-07-06 03:32:55 -04:00
parent 0f38ab4f0a
commit 8d47958473
5 changed files with 32 additions and 35 deletions

View File

@ -7,7 +7,7 @@ import RepositoryCard from "../components/RepositoryCard";
import { OctocatOcticon } from "../components/Icons";
import { styled } from "../lib/styles/stitches.config";
import { authorSocial } from "../lib/config";
import type { GetStaticProps } from "next";
import type { GetStaticProps, InferGetStaticPropsType } from "next";
import type { User, Repository } from "@octokit/graphql-schema";
import type { Project } from "../types";
@ -42,11 +42,7 @@ const GitHubLogo = styled(OctocatOcticon, {
fill: "$text",
});
type StaticProps = {
repos: Project[];
};
const Projects = ({ repos }: StaticProps) => {
const Projects = ({ repos }: InferGetStaticPropsType<typeof getStaticProps>) => {
return (
<>
<NextSeo
@ -75,7 +71,9 @@ const Projects = ({ repos }: StaticProps) => {
);
};
export const getStaticProps: GetStaticProps<StaticProps> = async () => {
export const getStaticProps: GetStaticProps<{
repos: Project[];
}> = async () => {
// don't fail the entire site build if the required API key for this page is missing
if (typeof process.env.GH_PUBLIC_TOKEN === "undefined" || process.env.GH_PUBLIC_TOKEN === "") {
console.warn(`ERROR: I can't fetch any GitHub projects without "GH_PUBLIC_TOKEN" set! Skipping for now...`);