Article-Collection etwas aufgeräumt und in einzelne Files ausgelagert.
This commit is contained in:
@@ -217,21 +217,16 @@ export const getGeneralInformation = async (): Promise<GeneralInfo[]> => {
|
||||
}
|
||||
}
|
||||
|
||||
export const getArticles = async (
|
||||
collectionName: string,
|
||||
filter: APIParams,
|
||||
params?: APIParams
|
||||
): Promise<TibiArticle[]> => {
|
||||
export const getArticles = async (collectionName: string, apiParams: APIParams): Promise<TibiArticle[]> => {
|
||||
try {
|
||||
let response = await api<TibiArticle[]>(collectionName, {
|
||||
method: "get",
|
||||
offset: 0,
|
||||
params,
|
||||
filter: {
|
||||
"article.general.public": true,
|
||||
...filter,
|
||||
},
|
||||
sort: "article.general.sort",
|
||||
...apiParams,
|
||||
})
|
||||
return response.data
|
||||
} catch (e) {
|
||||
|
||||
24
src/components/routes/ArticleDetails.svelte
Normal file
24
src/components/routes/ArticleDetails.svelte
Normal file
@@ -0,0 +1,24 @@
|
||||
<script lang="ts">
|
||||
import { currentLang } from "../../store"
|
||||
import { getArticles } from "../../api"
|
||||
|
||||
// import Article from "../widgets/Article.svelte"
|
||||
|
||||
$: if ($currentLang) {
|
||||
getArticles("articles", {
|
||||
filter: {
|
||||
"article.general.locale": $currentLang,
|
||||
},
|
||||
}).then((response) => {
|
||||
console.log(response)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h1>ARTICLE DETAILS</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import * as animateScroll from "svelte-scrollto"
|
||||
|
||||
import { generalInfo, currentLang } from "../../store"
|
||||
import { currentLang } from "../../store"
|
||||
import { getArticles } from "../../api"
|
||||
|
||||
import GoogleMaps from "../widgets/GoogleMaps.svelte"
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
$: if ($currentLang) {
|
||||
getArticles("articles", {
|
||||
"article.general.locale": $currentLang,
|
||||
filter: {
|
||||
"article.general.locale": $currentLang,
|
||||
},
|
||||
}).then((response) => {
|
||||
articleEntries = response
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user