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 NavigationManager NavigationManager
|
||||||
@inject WebClientTpos.Client.Services.PosDataService DataService
|
@inject WebClientTpos.Client.Services.PosDataService DataService
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
|
@inject WebClientTpos.Client.Services.AuthStateService AuthState
|
||||||
|
|
||||||
<MudThemeProvider IsDarkMode="true" Theme="AppTheme.DefaultDark" />
|
<MudThemeProvider IsDarkMode="true" Theme="AppTheme.DefaultDark" />
|
||||||
<MudPopoverProvider />
|
<MudPopoverProvider />
|
||||||
@@ -43,7 +44,7 @@
|
|||||||
<span class="pos-order-toggle__badge">@_orderCount</span>
|
<span class="pos-order-toggle__badge">@_orderCount</span>
|
||||||
}
|
}
|
||||||
</button>
|
</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>
|
<i data-lucide="settings"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -89,9 +90,9 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="pos-sidebar__footer">
|
<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>
|
<i data-lucide="settings" style="width:18px;height:18px;"></i>
|
||||||
<span>Quản trị</span>
|
<span>Quản lý</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
@@ -208,7 +209,7 @@
|
|||||||
try { await JS.InvokeVoidAsync("lucide.createIcons"); } catch { }
|
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 ToggleSidebar() => _sidebarOpen = !_sidebarOpen;
|
||||||
private void CloseSidebar() => _sidebarOpen = false;
|
private void CloseSidebar() => _sidebarOpen = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user