Pass error to svelte using a struct
...a very cursed struct
This commit is contained in:
@@ -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>
|
Reference in New Issue
Block a user