Skip to content

Commit

Permalink
Fix all typescript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Nov 9, 2023
1 parent 6b73786 commit e02b97c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions app/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"] = []
Expand All @@ -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) => {
Expand Down

0 comments on commit e02b97c

Please sign in to comment.