2020-11-13 16:42:32 +01:00
|
|
|
<script>
|
2020-11-19 19:39:22 +01:00
|
|
|
import { setContext, onMount } from "svelte"
|
2020-11-13 16:42:32 +01:00
|
|
|
import Component from "./Component.svelte"
|
2020-11-18 20:18:18 +01:00
|
|
|
import SDK from "../sdk"
|
2020-11-20 10:50:10 +01:00
|
|
|
import { routeStore, screenStore, createDataContextStore } from "../store"
|
2020-11-13 16:42:32 +01:00
|
|
|
|
2020-11-20 10:50:10 +01:00
|
|
|
// Provide contexts
|
|
|
|
setContext("sdk", SDK)
|
|
|
|
setContext("data", createDataContextStore())
|
2020-11-13 16:42:32 +01:00
|
|
|
|
2020-11-19 19:39:22 +01:00
|
|
|
let loaded = false
|
|
|
|
|
|
|
|
// Load app config
|
|
|
|
onMount(async () => {
|
|
|
|
await routeStore.actions.fetchRoutes()
|
|
|
|
await screenStore.actions.fetchScreens()
|
|
|
|
loaded = true
|
|
|
|
})
|
2020-11-13 16:42:32 +01:00
|
|
|
</script>
|
|
|
|
|
2020-11-19 19:39:22 +01:00
|
|
|
{#if loaded}
|
|
|
|
<Component definition={$screenStore.page.props} />
|
|
|
|
{/if}
|