Pass error to svelte using a struct

...a very cursed struct
This commit is contained in:
2024-08-09 18:15:08 +02:00
parent 2fe3bdbb8a
commit b7760c0942
7 changed files with 108 additions and 24 deletions

View File

@@ -0,0 +1,20 @@
<script lang="ts">
import { GetFood } from "$wails/main/App.js";
import { main } from '$wails/models'
let food: main.Food[] = [];
GetFood().then((result) => {
if (!result.success) {
console.error(result.error);
return;
}
food = result.data
console.log(food);
});
</script>
<template>
{#each food as f}
<div>{f.food}</div>
{/each}
</template>