Implement calling GetFood from FE

This commit is contained in:
2024-08-09 17:46:50 +02:00
parent 683c443b7f
commit b177416204
6 changed files with 24 additions and 54 deletions

View File

@@ -1,14 +1,9 @@
<script lang="ts">
import Header from "$lib/components/Header.svelte";
import Router from "$lib/router/Router.svelte";
import { Greet } from "../wailsjs/go/main/App.js";
import { GetFood } from "../wailsjs/go/main/App.js";
let resultText: string = "Please enter your name below 👇";
let name: string;
function greet(): void {
Greet(name).then((result) => (resultText = result));
}
GetFood().then((result) => console.log(result));
</script>
<template>

View File

@@ -1,6 +1,5 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {main} from '../models';
export function Foo():Promise<string>;
export function Greet(arg1:string):Promise<string>;
export function GetFood():Promise<Array<main.Food>>;

View File

@@ -2,10 +2,6 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function Foo() {
return window['go']['main']['App']['Foo']();
}
export function Greet(arg1) {
return window['go']['main']['App']['Greet'](arg1);
export function GetFood() {
return window['go']['main']['App']['GetFood']();
}

View File

@@ -0,0 +1,17 @@
export namespace main {
export class Food {
static createFrom(source: any = {}) {
return new Food(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
}
}
}