fix(ui): implement ServerIdentityService to resolve SSR profile fetch issues
- Added ServerIdentityService to handle profile requests directly from DB on server - Updated Program.cs to use ServerIdentityService in the Web project - Cleaned up diagnostic logs across the solution - Finalized Dashboard glass panel animations
This commit is contained in:
@@ -85,14 +85,6 @@
|
||||
|
||||
private bool _isSyncing = false;
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
Console.WriteLine($"[MainHubLayout] Rendered. IsBrowser: {System.OperatingSystem.IsBrowser()}");
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (_isSyncing) return;
|
||||
|
||||
@@ -110,9 +110,7 @@
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
Console.WriteLine("[Profile] Initializing...");
|
||||
_profile = await IdentityService.GetProfileAsync();
|
||||
Console.WriteLine($"[Profile] Profile loaded: {_profile?.Email ?? "NULL"}");
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -128,6 +128,14 @@
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
border-radius: 20px;
|
||||
padding: 1.5rem;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.glass-panel:hover {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-color: rgba(0, 255, 153, 0.2);
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
/* Reading Card */
|
||||
|
||||
@@ -121,17 +121,14 @@ public class IdentityService : IIdentityService
|
||||
{
|
||||
if (_cachedProfile != null)
|
||||
{
|
||||
Console.WriteLine("[IdentityService] Returning cached profile.");
|
||||
return _cachedProfile;
|
||||
}
|
||||
|
||||
if (_profileTask != null)
|
||||
{
|
||||
Console.WriteLine("[IdentityService] Awaiting existing profile task...");
|
||||
return await _profileTask;
|
||||
}
|
||||
|
||||
Console.WriteLine("[IdentityService] Starting new profile fetch task...");
|
||||
_profileTask = GetProfileInternalAsync();
|
||||
return await _profileTask;
|
||||
}
|
||||
@@ -142,13 +139,11 @@ public class IdentityService : IIdentityService
|
||||
{
|
||||
if (!System.OperatingSystem.IsBrowser())
|
||||
{
|
||||
Console.WriteLine("[IdentityService] Skipping profile fetch: Not in browser.");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (DateTime.UtcNow - _lastFetchAttempt < TimeSpan.FromSeconds(5))
|
||||
{
|
||||
Console.WriteLine("[IdentityService] Skipping profile fetch: Throttled.");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -156,23 +151,18 @@ public class IdentityService : IIdentityService
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetAsync("identity/profile");
|
||||
Console.WriteLine($"[IdentityService] Profile response: {response.StatusCode}");
|
||||
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||
{
|
||||
Console.WriteLine("[IdentityService] Unauthorized. Logging out...");
|
||||
await LogoutAsync();
|
||||
return null;
|
||||
}
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
var content = await response.Content.ReadAsStringAsync();
|
||||
Console.WriteLine($"[IdentityService] Raw content: {content}");
|
||||
var profile = await response.Content.ReadFromJsonAsync<UserProfile>();
|
||||
if (profile != null)
|
||||
{
|
||||
Console.WriteLine($"[IdentityService] Profile fetched: {profile.Email}");
|
||||
_cachedProfile = profile;
|
||||
await _storageService.SaveSecureString("nexus_user_email", profile.Email);
|
||||
await _storageService.SaveSecureString("nexus_user_tenant", profile.TenantId.ToString());
|
||||
@@ -183,9 +173,8 @@ public class IdentityService : IIdentityService
|
||||
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch
|
||||
{
|
||||
Console.WriteLine($"[IdentityService] ERROR: {ex.Message}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
|
||||
Reference in New Issue
Block a user