fix compile errors

This commit is contained in:
2025-04-10 12:06:24 +02:00
parent 5b0b555557
commit 1306939d58

View File

@@ -7,6 +7,8 @@ import (
"crypto/tls" "crypto/tls"
"errors" "errors"
"fmt" "fmt"
"sync"
"strings"
"net/http" "net/http"
"net/http/cookiejar" "net/http/cookiejar"
"os" "os"
@@ -78,11 +80,11 @@ func CreateUnifiClient() (*UnifiClient, error) {
return unifiClient, nil 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() s.mutex.Lock()
defer s.mutex.Unlock() defer s.mutex.Unlock()
err := action(s.client) err := action(s.Client)
if err == nil { if err == nil {
return nil return nil
} }
@@ -94,9 +96,10 @@ func (s *Session) WithSession(action func(c *unifi.Client) error) error {
return action(s.Client) return action(s.Client)
} }
return err
} }
func isSessionExpired(err error) bool { func IsSessionExpired(err error) bool {
if err == nil { if err == nil {
return false return false
} }