feat: downgrade sendClientCommand() from method to function

This commit is contained in:
Sebastian Mark 2024-10-30 19:29:40 +01:00
parent f19ab81dc8
commit 9656db5335

View file

@ -8,8 +8,8 @@ import (
GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models" GoTomato "git.smsvc.net/pomodoro/GoTomato/pkg/models"
) )
// Sends to ClientCommand to the clients websocket // Sends a message to the clients websocket
func (c Client) sendClientCommand(msg GoTomato.ClientCommand) { func sendClientCommand(c Client, msg GoTomato.ClientCommand) {
messageBytes, err := json.Marshal(msg) messageBytes, err := json.Marshal(msg)
if err != nil { if err != nil {
log.Error("Error marshalling!", "reason", err) log.Error("Error marshalling!", "reason", err)
@ -30,7 +30,7 @@ func (c Client) SendCmd(cmd string) {
Password: c.Password, Password: c.Password,
} }
c.sendClientCommand(message) sendClientCommand(c, message)
} }
// Sends the new PomodoroConfig to the server // Sends the new PomodoroConfig to the server
@ -41,5 +41,5 @@ func (c Client) SendSettingsUpdate(settings GoTomato.PomodoroConfig) {
Settings: settings, Settings: settings,
} }
c.sendClientCommand(message) sendClientCommand(c, message)
} }