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

8
app.go
View File

@@ -20,6 +20,10 @@ func (a *App) startup(ctx context.Context) {
a.ctx = ctx
}
func (a *App) GetFood() ([]Food, error) {
return foodService.GetRecent()
func (a *App) GetFood() WailsFood {
data, err := foodService.GetRecent()
if err != nil {
return WailsFood{Success: false, Error: err.Error()}
}
return WailsFood{Data: data, Success: true}
}