Content-Seiten und Language Chooser + Collections so überarbeitet, dass ein Umschalten zwischen Sprachen und Pages möglich ist. Collection der Seiten wurde um eine Priorität erweitert. Navigation zeigt aktives Item an. Entsprechende CSS Klassen angepasst und für neue Projekte sauberer strukturiert.

This commit is contained in:
2022-05-31 15:55:35 +02:00
parent fcf5490d5a
commit 87aa1689f3
8 changed files with 162 additions and 109 deletions

View File

@@ -186,13 +186,18 @@ export const sendEmail = async (type: string = "contactForm", data: any, noToken
})
}
export const getContent = async (path: string, lang: string, filter?: APIParams): Promise<Content> => {
export const getContent = async (locale: string, filter?: APIParams, params?: APIParams): Promise<Content[]> => {
const c = await api<Content[]>("content", {
limit: 1,
filter: { path, locale: lang, ...filter },
// limit: 1,
params: {
sort: "priority",
...params,
},
filter: { locale, ...filter },
sort: "-priority",
})
if (c?.data?.length) {
return c.data[0]
return c.data
}
return null
}