add a route
This commit is contained in:
26
frontend/src/routes/Thing.svelte
Normal file
26
frontend/src/routes/Thing.svelte
Normal file
@ -0,0 +1,26 @@
|
||||
<script lang="ts">
|
||||
import { GetThings } from "../../wailsjs/go/things/Service";
|
||||
import { model } from "../../wailsjs/go/models";
|
||||
import { onMount } from "svelte";
|
||||
import { Heading } from "flowbite-svelte";
|
||||
|
||||
let { thingID }: { thingID: number } = $props();
|
||||
let thing: model.Thing = $state(new model.Thing());
|
||||
|
||||
function update() {
|
||||
GetThings().then((ts) => {
|
||||
ts.forEach((t) => {
|
||||
if (t.ID === thingID) {
|
||||
thing = t;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
onMount(update);
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<Heading>
|
||||
{thing.Name}
|
||||
</Heading>
|
||||
</div>
|
Reference in New Issue
Block a user