fix: POS settings button navigates by role — staff→/staff, admin→/admin
PosLayout.razor hardcoded navigation to /admin for the settings button and sidebar link, causing staff users to land on the admin page. Now uses AuthStateService.GetPortalUrl() for role-aware routing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject WebClientTpos.Client.Services.PosDataService DataService
|
||||
@inject IJSRuntime JS
|
||||
@inject WebClientTpos.Client.Services.AuthStateService AuthState
|
||||
|
||||
<MudThemeProvider IsDarkMode="true" Theme="AppTheme.DefaultDark" />
|
||||
<MudPopoverProvider />
|
||||
@@ -43,7 +44,7 @@
|
||||
<span class="pos-order-toggle__badge">@_orderCount</span>
|
||||
}
|
||||
</button>
|
||||
<button class="admin-icon-btn pos-admin-btn" @onclick="GoToAdmin" title="Admin">
|
||||
<button class="admin-icon-btn pos-admin-btn" @onclick="GoToPortal" title="Quản lý">
|
||||
<i data-lucide="settings"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -89,9 +90,9 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="pos-sidebar__footer">
|
||||
<a class="pos-sidebar__link" href="/admin" @onclick="CloseSidebar">
|
||||
<a class="pos-sidebar__link" href="@(AuthState.GetPortalUrl())" @onclick="CloseSidebar">
|
||||
<i data-lucide="settings" style="width:18px;height:18px;"></i>
|
||||
<span>Quản trị</span>
|
||||
<span>Quản lý</span>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -208,7 +209,7 @@
|
||||
try { await JS.InvokeVoidAsync("lucide.createIcons"); } catch { }
|
||||
}
|
||||
|
||||
private void GoToAdmin() => NavigationManager.NavigateTo("/admin");
|
||||
private void GoToPortal() => NavigationManager.NavigateTo(AuthState.GetPortalUrl());
|
||||
|
||||
private void ToggleSidebar() => _sidebarOpen = !_sidebarOpen;
|
||||
private void CloseSidebar() => _sidebarOpen = false;
|
||||
|
||||
Reference in New Issue
Block a user