From 53a266df4468b7d85ab8c3748261b26b4bf304dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Dere=C5=BEi=C4=87?= Date: Tue, 9 Jan 2024 16:28:12 +0100 Subject: [PATCH] fixed fetching of available years --- README.md | 4 +--- app/lib/actions/monthActions.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2fc1f8d..771ae4d 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ # ToDo -* infinite scroll - * https://stackoverflow.com/questions/67624601/how-to-implement-infinite-scroll-in-next-js +* year pagination * build & deploy via docker - # Authentication Authentication consists of the following parts: * `next-auth` boilerplate diff --git a/app/lib/actions/monthActions.ts b/app/lib/actions/monthActions.ts index b6c083a..b46ca95 100644 --- a/app/lib/actions/monthActions.ts +++ b/app/lib/actions/monthActions.ts @@ -76,7 +76,7 @@ export const fetchAvailableYears = withUser(async (user:AuthenticatedUser) => { const dbClient = await getDbClient(); // query mnogodb for all `yearMonth` values - const yearMonths = await dbClient.collection("lokacije").distinct("year", { userId }); + const yearMonths = await dbClient.collection("lokacije").distinct("yearMonth.year", { userId }); return(yearMonths); })