From 1306939d58cb6ea27ad808c29eff80c111cf36bd Mon Sep 17 00:00:00 2001 From: Vegard Engen Date: Thu, 10 Apr 2025 12:06:24 +0200 Subject: [PATCH] fix compile errors --- internal/unifi/unifi.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/unifi/unifi.go b/internal/unifi/unifi.go index cfebb8e..6a76077 100644 --- a/internal/unifi/unifi.go +++ b/internal/unifi/unifi.go @@ -7,6 +7,8 @@ import ( "crypto/tls" "errors" "fmt" + "sync" + "strings" "net/http" "net/http/cookiejar" "os" @@ -78,11 +80,11 @@ func CreateUnifiClient() (*UnifiClient, error) { return unifiClient, nil } -func (s *Session) WithSession(action func(c *unifi.Client) error) error { +func (s *UnifiClient) WithSession(action func(c *unifi.Client) error) error { s.mutex.Lock() defer s.mutex.Unlock() - err := action(s.client) + err := action(s.Client) if err == nil { return nil } @@ -94,9 +96,10 @@ func (s *Session) WithSession(action func(c *unifi.Client) error) error { return action(s.Client) } + return err } -func isSessionExpired(err error) bool { +func IsSessionExpired(err error) bool { if err == nil { return false }