debug: add tenant context logging to GetProfile
This commit is contained in:
@@ -2,6 +2,7 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"aggios-app/backend/internal/repository"
|
"aggios-app/backend/internal/repository"
|
||||||
@@ -59,8 +60,13 @@ func (h *AgencyHandler) GetProfile(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
// Get tenant from context (set by middleware)
|
// Get tenant from context (set by middleware)
|
||||||
tenantID := r.Context().Value("tenantID")
|
tenantID := r.Context().Value("tenantID")
|
||||||
|
log.Printf("DEBUG GetProfile: tenantID from context = %v (type: %T)", tenantID, tenantID)
|
||||||
|
|
||||||
if tenantID == nil {
|
if tenantID == nil {
|
||||||
http.Error(w, "Tenant not found", http.StatusUnauthorized)
|
log.Printf("DEBUG GetProfile: tenantID is nil, checking subdomain from context")
|
||||||
|
subdomain := r.Context().Value("subdomain")
|
||||||
|
log.Printf("DEBUG GetProfile: subdomain = %v", subdomain)
|
||||||
|
http.Error(w, "Tenant not found in context", http.StatusUnauthorized)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user