forked from cms/tibi-svelte-starter
39 lines
858 B
Svelte
39 lines
858 B
Svelte
<script lang="ts">
|
|
// import { _ } from "svelte-i18n"
|
|
import { currentLang } from "../../store"
|
|
import { getContent } from "../../api"
|
|
|
|
let loading = true
|
|
let projects: Content[]
|
|
let currentImpressionsProject: Content
|
|
|
|
const loadContent = async () => {
|
|
let apiParams: APIParams = {
|
|
filter: {
|
|
public: true,
|
|
locale: $currentLang,
|
|
type: "project",
|
|
},
|
|
}
|
|
|
|
loading = true
|
|
const c = await getContent(apiParams)
|
|
if (c) {
|
|
projects = c
|
|
currentImpressionsProject = projects[Math.floor(Math.random() * projects.length)]
|
|
}
|
|
|
|
loading = false
|
|
}
|
|
|
|
loadContent()
|
|
|
|
$: console.log(projects)
|
|
</script>
|
|
|
|
{#if projects}
|
|
<section>
|
|
{JSON.stringify(projects)}
|
|
</section>
|
|
{/if}
|