From e02b97c673b53e49bebad876293bb629e78e8c56 Mon Sep 17 00:00:00 2001 From: Mike Decker Date: Thu, 9 Nov 2023 11:10:49 -0800 Subject: [PATCH] Fix all typescript errors --- app/[...slug]/page.tsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/[...slug]/page.tsx b/app/[...slug]/page.tsx index 4210835d..08b4e035 100644 --- a/app/[...slug]/page.tsx +++ b/app/[...slug]/page.tsx @@ -58,12 +58,17 @@ export const generateStaticParams = async () => { const params = new DrupalJsonApiParams(); params.addPageLimit(50); - let paths: GetStaticPathsResult["paths"] = await getPathsFromContext([ + const contentTypes = [ 'node--stanford_page', 'node--stanford_event', 'node--stanford_news', - 'node--stanford_person' - ], {}, {params: params.getQueryObject()}); + 'node--stanford_person', + 'node--stanford_policy', + 'node--stanford_publication', + 'node--stanford_course', + ] + + let paths: GetStaticPathsResult["paths"] = await getPathsFromContext(contentTypes, {}, {params: params.getQueryObject()}); let fetchMore = process.env.BUILD_COMPLETE === 'true'; let fetchedData: GetStaticPathsResult["paths"] = [] @@ -72,18 +77,13 @@ export const generateStaticParams = async () => { console.log('Fetching page ' + page); params.addPageOffset(page * 50); - fetchedData = await getPathsFromContext([ - 'node--stanford_page', - 'node--stanford_event', - 'node--stanford_news', - 'node--stanford_person' - ], {}, {params: params.getQueryObject()}) + fetchedData = await getPathsFromContext(contentTypes, {}, {params: params.getQueryObject()}) paths = [...paths, ...fetchedData]; fetchMore = fetchedData.length > 0; page++; } - return paths.map(path => typeof path !== "string" ? path?.params : path).slice(0, (process.env.BUILD_COMPLETE ? -1 : 1)); + return paths.map(path => typeof path !== "string" ? path?.params : path).slice(0, (process.env.BUILD_COMPLETE === 'true' ? -1 : 1)); } const Page = async (context: GetStaticPropsContext) => {