<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>
