2020-11-13 16:42:32 +01:00
|
|
|
<script>
|
2020-11-17 13:08:24 +01:00
|
|
|
import { screenStore, routeStore } from "@budibase/component-sdk"
|
2020-11-13 16:42:32 +01:00
|
|
|
import Component from "./Component.svelte"
|
|
|
|
import { getValidProps } from "../utils"
|
|
|
|
|
|
|
|
export let params
|
|
|
|
|
|
|
|
// Get the screen definition for the current route
|
2020-11-17 13:08:24 +01:00
|
|
|
$: screenDefinition = $screenStore.activeScreen
|
|
|
|
|
|
|
|
// Update route params
|
|
|
|
$: routeStore.actions.setRouteParams(params)
|
|
|
|
|
|
|
|
// Redirect to home page if no matching route
|
|
|
|
$: {
|
|
|
|
if (screenDefinition == null) {
|
|
|
|
routeStore.actions.navigate("/")
|
|
|
|
}
|
|
|
|
}
|
2020-11-13 16:42:32 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if screenDefinition}
|
2020-11-17 13:08:24 +01:00
|
|
|
<Component definition={screenDefinition.props} />
|
2020-11-13 16:42:32 +01:00
|
|
|
{/if}
|