From d710bcfdaf99f7c6ead2e8354edddc82837c312a Mon Sep 17 00:00:00 2001 From: Gregor Riegler Date: Sat, 29 Jun 2024 20:58:15 +0200 Subject: [PATCH] fixes no goal set state and starting of timer --- goal/goal.go | 5 ++++- timer.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/goal/goal.go b/goal/goal.go index aa20449a..f732796e 100644 --- a/goal/goal.go +++ b/goal/goal.go @@ -34,7 +34,7 @@ func Goal(configuration config.Configuration, parameter []string) { func goal(configuration config.Configuration, parameter []string) error { if configuration.TimerRoom == "" { - return errors.New("No room sepcified. Set MOB_TIMER_ROOM to your timer.mob.sh room in .mob file.") + return errors.New("No room specified. Set MOB_TIMER_ROOM to your timer.mob.sh room in .mob file.") } var err error if len(parameter) <= 0 { @@ -114,6 +114,9 @@ func getGoalHttp(room string, timerService string, disableSslVerification bool) if response.StatusCode >= 300 { return "", errors.New("got an error while requesting it: " + url + " " + response.Status) } + if response.StatusCode == 204 { + return "", nil + } body, err := io.ReadAll(response.Body) if err != nil { say.Debug(err.Error()) diff --git a/timer.go b/timer.go index f11621e2..37310a90 100644 --- a/timer.go +++ b/timer.go @@ -13,7 +13,7 @@ import ( ) func StartTimer(timerInMinutes string, configuration config.Configuration) { - if err := startTimer(configuration.Timer, configuration); err != nil { + if err := startTimer(timerInMinutes, configuration); err != nil { Exit(1) } }