@page "/profile" @using Indotalent.Features.Profile.Session @using Microsoft.AspNetCore.Authorization @using Indotalent.Infrastructure.Authorization.Identity @attribute [Authorize(Roles = $"{ApplicationRoles.Admin},{ApplicationRoles.Member}")] @using Indotalent.Features.Profile.Avatar.Components @using Indotalent.Features.Profile.Password.Components @using Indotalent.Features.Profile.PersonalInformation @using Indotalent.Features.Profile.Password @using Indotalent.Features.Profile.Avatar @using Indotalent.Features.Profile.PersonalInformation.Components @using MudBlazor @inject NavigationManager NavigationManager
@code { private int _activeTabIndex = 0; protected override void OnInitialized() { var uri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri); if (Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uri.Query).TryGetValue("tab", out var tabValue)) { _activeTabIndex = tabValue.ToString().ToLower() switch { "personal" => 0, "password" => 1, "avatar" => 2, "session" => 3, _ => 0 }; } } private void OnTabChanged(int index) { _activeTabIndex = index; string tabName = index switch { 0 => "personal", 1 => "password", 2 => "avatar", 3 => "session", _ => "personal" }; NavigationManager.NavigateTo($"/profile?tab={tabName}", replace: false); } }