feat: update settings handling for pomodoro configuration

- add `UpdateSettings()` to update pomodoro configuration
- refactor client command handling to use `UpdateSettings()`

🤖
This commit is contained in:
Sebastian Mark 2024-10-28 09:30:00 +01:00
parent f0d7dc80fc
commit 3a6be4c187
2 changed files with 9 additions and 5 deletions

View file

@ -49,11 +49,7 @@ func handleClientCommands(ws *websocket.Conn) {
}
case "updateSettings":
if !pomodoro.IsPomodoroOngoing() {
if clientCommand.Settings != (models.PomodoroConfig{}) {
shared.Message.Settings = clientCommand.Settings
shared.Message.TimeLeft = clientCommand.Settings.Work
}
pomodoro.UpdateSettings(clientCommand.Settings)
}
}
}