feat(ui): Hub Navigation, Profile Dashboard and Auth Stability Fixes #31

Merged
mjasin merged 11 commits from feat/hub-navigation-profile-dashboard into develop 2026-05-10 17:36:36 +00:00
3 changed files with 22 additions and 1 deletions
Showing only changes of commit ab605dff42 - Show all commits
@@ -85,6 +85,14 @@
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,7 +110,9 @@
protected override async Task OnInitializedAsync()
{
Console.WriteLine("[Profile] Initializing...");
_profile = await IdentityService.GetProfileAsync();
Console.WriteLine($"[Profile] Profile loaded: {_profile?.Email ?? "NULL"}");
StateHasChanged();
}
2
@@ -121,14 +121,17 @@ public class IdentityService : IIdentityService
{
if (_cachedProfile != null)
{
Console.WriteLine("[IdentityService] Returning cached profile.");
return _cachedProfile;
}
if (_profileTask != null)
{
mjasin marked this conversation as resolved
Review

Use const variables instead of magic strings

Use const variables instead of *magic strings*
Console.WriteLine("[IdentityService] Awaiting existing profile task...");
mjasin marked this conversation as resolved
Review

Use const variables instead of magic strings

Use const variables instead of *magic strings*
return await _profileTask;
mjasin marked this conversation as resolved
Review

Use const variables instead of magic strings

Use const variables instead of *magic strings*
}
Console.WriteLine("[IdentityService] Starting new profile fetch task...");
_profileTask = GetProfileInternalAsync();
return await _profileTask;
}
@@ -139,11 +142,13 @@ 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;
}
@@ -151,18 +156,23 @@ 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());
@@ -173,8 +183,9 @@ public class IdentityService : IIdentityService
return null;
}
catch
catch (Exception ex)
{
Console.WriteLine($"[IdentityService] ERROR: {ex.Message}");
return null;
}
finally
1