Get routes by category and display them

This commit is contained in:
Alessio Davoli 2023-11-27 03:58:08 +01:00
parent 12e1351cca
commit 40dd8d0fb2

View file

@ -1,13 +1,22 @@
<script lang="ts"> <script lang="ts">
import Route from '$lib/components/Route.svelte'; import Route from '$lib/components/Route.svelte';
import HomeHeader from '$lib/components/HomeHeader.svelte'; import HomeHeader from '$lib/components/HomeHeader.svelte';
export let data; import { onMount } from 'svelte';
import { getRouteByCategory } from '$lib/repo';
let id = 0;
let routes = [];
onMount(async () => {
id = Number(window.location.href.split('paths/')[1]);
routes = await getRouteByCategory(id);
})
</script> </script>
<HomeHeader title={data.title}></HomeHeader> <!--
<HomeHeader title={title}></HomeHeader>-->
<div> <div>
{#each data.routes as route} {#each routes as route}
<Route {route}></Route> <Route {route}></Route>
{/each} {/each}
</div> </div>