Implement settings api

This commit is contained in:
2024-08-09 18:49:47 +02:00
parent f105595195
commit 5ec2ee18b8
2 changed files with 31 additions and 1 deletions

9
app.go
View File

@@ -20,6 +20,7 @@ func (a *App) startup(ctx context.Context) {
a.ctx = ctx
}
// region food
func (a *App) GetFood() WailsFood {
data, err := foodService.GetRecent()
if err != nil {
@@ -42,4 +43,12 @@ func (a *App) UpdateFood(food Food) WailsFood1 {
return WailsFood1{Success: false, Error: err.Error()}
}
return WailsFood1{Data: data, Success: true}
}
// region settings
func (a *App) GetSettings() settings {
return Settings
}
func (a *App) SetSetting(key string, value any) settings {
return settingsService.Set(key, value)
}