forked from cms/tibi-svelte-starter
neue Komponente für Artikellisten. Möglichkeit, Artikel Seiten zuzuweisen.
This commit is contained in:
25
src/components/widgets/ArticlesList.svelte
Normal file
25
src/components/widgets/ArticlesList.svelte
Normal file
@@ -0,0 +1,25 @@
|
||||
<script lang="ts">
|
||||
import { currentLang } from "../../store"
|
||||
import { getArticles } from "../../api"
|
||||
|
||||
import Article from "../widgets/Article.svelte"
|
||||
|
||||
export let tag: string
|
||||
|
||||
let articleEntries: CollectionEntry[] = []
|
||||
|
||||
$: if ($currentLang) {
|
||||
getArticles("articles", {
|
||||
filter: {
|
||||
"article.general.locale": $currentLang,
|
||||
"article.general.tags": { $in: [tag] },
|
||||
},
|
||||
}).then((response) => {
|
||||
articleEntries = response
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
{#each articleEntries || [] as entry}
|
||||
<Article entry="{entry}" />
|
||||
{/each}
|
||||
Reference in New Issue
Block a user