1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

refactor: flash messages framework (resolve #446)

This commit is contained in:
Ferdinand Mütsch
2023-01-02 18:05:28 +01:00
parent a1444bca8c
commit 746608c062
22 changed files with 214 additions and 113 deletions

View File

@@ -6,6 +6,7 @@ import (
)
type SettingsViewModel struct {
Messages
User *models.User
LanguageMappings []*models.LanguageMapping
Aliases []*SettingsVMCombinedAlias
@@ -16,8 +17,6 @@ type SettingsViewModel struct {
UserFirstData time.Time
SupportContact string
ApiKey string
Success string
Error string
}
type SettingsVMCombinedAlias struct {
@@ -36,11 +35,11 @@ func (s *SettingsViewModel) SubscriptionsEnabled() bool {
}
func (s *SettingsViewModel) WithSuccess(m string) *SettingsViewModel {
s.Success = m
s.SetSuccess(m)
return s
}
func (s *SettingsViewModel) WithError(m string) *SettingsViewModel {
s.Error = m
s.SetError(m)
return s
}