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