fix: date fetching only if needed

This commit is contained in:
Julian Krauser 2025-02-14 15:38:29 +01:00
parent 53c2ab6912
commit 24e6061002

View file

@ -112,7 +112,7 @@ const years = ref<Array<number>>([]);
const pagination = ref<Meta>({ page: 0, pageSize: 0, pageCount: 0, total: 0 });
const activeYear = ref<number>(0);
if (props.data?.lookup.list_with_date) {
if (props.data?.lookup.list_with_date != "none") {
const { data: year } = await useAsyncData<Array<number>>("distinct-years", () =>
$fetch(`${baseUrl}/api/custom/${props.data?.lookup.collection}/distinct-years`)
);
@ -121,7 +121,7 @@ if (props.data?.lookup.list_with_date) {
}
const { data: collections } = await useAsyncData("collection", () =>
find<BaseCollection>(props.data?.lookup.collection ?? "", {
...(props.data?.lookup?.list_with_date
...(props.data?.lookup?.list_with_date != "none"
? {
sort: "date:desc",
filters: {