web: returns empty api.Timer if its not set on Get method

This commit is contained in:
Marvin Preuss 2021-08-22 19:51:40 +02:00
parent 684dc1ef7c
commit 7b092aa8c4

View File

@ -88,6 +88,11 @@ func (t TimerServer) Create(ctx context.Context, req *api.Timer) (*api.Timer, er
// Get just returns the status of the timer.
func (t TimerServer) Get(ctx context.Context, req *api.TimerEmpty) (*api.Timer, error) {
// Nothing there yet, so return a fresh struct.
if timer.T.Req == nil {
return &api.Timer{}, nil
}
return timer.T.Req, nil
}