Streamline event info page getStaticPaths
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e11db336ac
commit
0b62d2810e
|
@ -44,25 +44,23 @@ export const getStaticProps: GetStaticProps<Props, Params> = async (
|
|||
|
||||
export const getStaticPaths: GetStaticPaths<Params> = async () => {
|
||||
const years = await getEventYears();
|
||||
const terms = (
|
||||
const events = (
|
||||
await Promise.all(
|
||||
years.map(async (year) => {
|
||||
const termsInYear = await getEventTermsByYear(year);
|
||||
return termsInYear.map((term) => ({ year, term }));
|
||||
})
|
||||
)
|
||||
).flat();
|
||||
const events = (
|
||||
await Promise.all(
|
||||
terms.map(async (term) => {
|
||||
const eventsInTerm = await getEventsByTerm(term.year, term.term);
|
||||
return await Promise.all(
|
||||
termsInYear.map(async (term) => {
|
||||
const eventsInTerm = await getEventsByTerm(year, term);
|
||||
return eventsInTerm.map((event) => ({
|
||||
...term,
|
||||
year,
|
||||
term,
|
||||
event,
|
||||
}));
|
||||
})
|
||||
);
|
||||
})
|
||||
)
|
||||
).flat();
|
||||
).flat(2);
|
||||
|
||||
return {
|
||||
paths: events.map((params) => ({ params })),
|
||||
|
|
Loading…
Reference in New Issue