Files
QuantEngineByItz/src/dotnet/QuantEngine.Web/Components/App.razor
T
kjh2064 b906e0f282 fix: add Router Found template to resolve Blazor routing error
Router component requires Found and NotFound child templates.
Adds RouteView with MainLayout as default layout and NotFound error page.

Fixes: "Router component requires a value for the parameter Found" error

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-06 00:38:13 +09:00

68 lines
2.5 KiB
Plaintext

@using System.Reflection
@using QuantEngine.Web.Client.Pages
@using Microsoft.AspNetCore.Components.Routing
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap" rel="stylesheet" />
<link href="_content/MudBlazor/MudBlazor.min.css" rel="stylesheet" />
<link rel="stylesheet" href="app.css" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<link rel="alternate icon" type="image/png" href="favicon.png" />
<HeadOutlet />
</head>
<body>
<div id="app">
<CascadingAuthenticationState>
<Router AppAssembly="@typeof(App).Assembly"
AdditionalAssemblies="new[] { typeof(QuantEngine.Web.Client.Pages.Dashboard).Assembly }"
OnNavigateAsync="@OnNavigateAsync">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(QuantEngine.Web.Client.Layout.MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>페이지를 찾을 수 없음</PageTitle>
<div class="alert alert-danger">
<h3>404 - 페이지를 찾을 수 없습니다</h3>
<p>요청하신 페이지가 존재하지 않습니다.</p>
</div>
</NotFound>
</Router>
</CascadingAuthenticationState>
</div>
<script src="_framework/blazor.web.js"></script>
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
</body>
</html>
@code {
private async Task OnNavigateAsync(Microsoft.AspNetCore.Components.Routing.NavigationContext context)
{
// /Account/* paths are Razor Pages, not Blazor components
// Force browser navigation instead of Blazor routing
if (context.Path.StartsWith("Account/", StringComparison.OrdinalIgnoreCase)
|| context.Path.StartsWith("/Account/", StringComparison.OrdinalIgnoreCase))
{
// Prevent Blazor from handling this route
// Force a full page reload via browser
await Task.CompletedTask;
// This triggers browser to make a new request, bypassing Blazor
}
else
{
await Task.CompletedTask;
}
}
}