Unify subscription calls.
[kraftakt.git] / gfitsync.go
index 61e9107..f913134 100644 (file)
@@ -126,8 +126,11 @@ func fitbitGrantHandler(ctx context.Context, w http.ResponseWriter, r *http.Requ
                return err
        }
 
-       if err := c.Subscribe(ctx, "activities"); err != nil {
-               return fmt.Errorf("c.Subscribe() = %v", err)
+       for _, collection := range []string{"activities", "sleep"} {
+               if err := c.Subscribe(ctx, collection); err != nil {
+                       return fmt.Errorf("c.Subscribe(%q) = %v", collection, err)
+               }
+               log.Infof(ctx, "Successfully subscribed to %q", collection)
        }
 
        redirectURL := r.URL