Files
deepdrft/DeepDrftWeb.Client/Routes.razor
T
Daniel Harvey 7c9f3b1630 fix(client): force server reload for /account/* routes unknown to WASM router
AuthBlocksWeb pages live in a server-only assembly not bundled in the WASM
client. When InteractiveAuto switches routing to WASM, /account/login has
no matching component and shows NotFound. Routes.razor now intercepts
NotFound for /account/* paths and forces a full-page reload to the server
router, which knows the real login page via AddAdditionalAssemblies.
2026-05-18 23:14:15 -04:00

25 lines
1013 B
Plaintext

@inject NavigationManager NavigationManager
<Router AppAssembly="typeof(_Imports).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)">
<NotAuthorized>
@{
NavigationManager.NavigateTo($"account/login?returnUrl={Uri.EscapeDataString(NavigationManager.Uri)}", forceLoad: true);
}
</NotAuthorized>
</AuthorizeRouteView>
</Found>
<NotFound>
@{
// Routes owned by server-side assemblies (e.g. /account/*) are not visible to the
// WASM router. Force a full-page reload so the server router handles them instead.
var path = new Uri(NavigationManager.Uri).AbsolutePath;
if (path.StartsWith("/account", StringComparison.OrdinalIgnoreCase))
{
NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true);
}
}
</NotFound>
</Router>