forked from cms/tibi-svelte-starter
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:
13
src/api.ts
13
src/api.ts
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user