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 () => {
|
export const getStaticPaths: GetStaticPaths<Params> = async () => {
|
||||||
const years = await getEventYears();
|
const years = await getEventYears();
|
||||||
const terms = (
|
const events = (
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
years.map(async (year) => {
|
years.map(async (year) => {
|
||||||
const termsInYear = await getEventTermsByYear(year);
|
const termsInYear = await getEventTermsByYear(year);
|
||||||
return termsInYear.map((term) => ({ year, term }));
|
return await Promise.all(
|
||||||
|
termsInYear.map(async (term) => {
|
||||||
|
const eventsInTerm = await getEventsByTerm(year, term);
|
||||||
|
return eventsInTerm.map((event) => ({
|
||||||
|
year,
|
||||||
|
term,
|
||||||
|
event,
|
||||||
|
}));
|
||||||
|
})
|
||||||
|
);
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
).flat();
|
).flat(2);
|
||||||
const events = (
|
|
||||||
await Promise.all(
|
|
||||||
terms.map(async (term) => {
|
|
||||||
const eventsInTerm = await getEventsByTerm(term.year, term.term);
|
|
||||||
return eventsInTerm.map((event) => ({
|
|
||||||
...term,
|
|
||||||
event,
|
|
||||||
}));
|
|
||||||
})
|
|
||||||
)
|
|
||||||
).flat();
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
paths: events.map((params) => ({ params })),
|
paths: events.map((params) => ({ params })),
|
||||||
|
|
Loading…
Reference in New Issue