vehicle and base list items

This commit is contained in:
Julian Krauser 2024-11-03 15:34:48 +01:00
parent 3df3ba4ebc
commit 4ea0f9b5a1
9 changed files with 61 additions and 9 deletions

View file

@ -11,6 +11,7 @@ import type Article from "../types/collection/article";
import type Event from "../types/collection/event";
import type Lookup from "../types/collection/lookup";
import type Operation from "../types/collection/operation";
import type Vehicle from "../types/collection/vehicle";
import type Page from "../types/collection/page";
import type NavbarSubItem from "../types/component/itemsNavbarSubItem";
import type Global from "../types/single/global";
@ -48,14 +49,14 @@ const { data: pages } = await useAsyncData("pages", () =>
);
const page = ref<Page | undefined>(Array.isArray(pages.value?.data) ? pages.value.data[0] : pages.value?.data);
let detail = ref<Article | Operation | Event | undefined>(undefined);
let detail = ref<Article | Operation | Event | Vehicle | undefined>(undefined);
const searchDetail = params[2] || (params[1] && navbar_sub_items.value.length == 0);
if (searchDetail) {
const paramsFind = params[2] ? [params[0], params[1]] : [params[0]];
const { data: lookup } = await useAsyncData("lookup", () => find<Lookup>("collection-lookups"));
const activeLookup: Lookup | undefined = lookup.value?.data.find((l) => paramsFind.includes(l.reference));
const { data: details } = await useAsyncData("detail", () =>
find<Article | Operation | Event>(activeLookup?.collection ?? "", {
find<Article | Operation | Event | Vehicle>(activeLookup?.collection ?? "", {
populate: "*",
filters: {
slug: params[2] ?? params[1],