chore: schemas, styles, cleanup
This commit is contained in:
parent
e0c0c5ccd2
commit
7caf3370ff
17 changed files with 123 additions and 55 deletions
|
@ -42,8 +42,19 @@ const sortBooksByYear = (books) => {
|
|||
return Object.values(years).filter(year => year['value'] > 2017)
|
||||
}
|
||||
|
||||
const currentYear = new Date().getFullYear()
|
||||
|
||||
export default async function () {
|
||||
const books = await fetchAllBooks()
|
||||
const sortedByYear = sortBooksByYear(books)
|
||||
const booksForCurrentYear = sortedByYear.find(
|
||||
yearGroup => yearGroup.value === currentYear
|
||||
)?.data || []
|
||||
|
||||
return { all: books, years: sortBooksByYear(books), feed: books.filter(book => book['feed']) }
|
||||
return {
|
||||
all: books,
|
||||
years: sortedByYear,
|
||||
currentYear: booksForCurrentYear,
|
||||
feed: books.filter(book => book['feed'])
|
||||
}
|
||||
}
|
Reference in a new issue