| | | 1 | | @using Pomodoro.Web.Components |
| | | 2 | | |
| | | 3 | | <Router AppAssembly="@typeof(App).Assembly"> |
| | | 4 | | <Found Context="routeData"> |
| | 41 | 5 | | <ErrorBoundary @ref="_errorBoundary"> |
| | 41 | 6 | | <ChildContent> |
| | 41 | 7 | | <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> |
| | 41 | 8 | | <FocusOnNavigate RouteData="@routeData" Selector="h1" /> |
| | 41 | 9 | | </ChildContent> |
| | 41 | 10 | | <ErrorContent Context="exception"> |
| | | 11 | | <ErrorDisplay Exception="exception" OnRetry="RecoverError" /> |
| | | 12 | | </ErrorContent> |
| | | 13 | | </ErrorBoundary> |
| | | 14 | | </Found> |
| | | 15 | | <NotFound> |
| | | 16 | | <CustomPageTitle Value="@GetNotFoundPageTitle()" /> |
| | | 17 | | <LayoutView Layout="@typeof(MainLayout)"> |
| | 20 | 18 | | <p role="alert">@Constants.Routing.NotFoundMessage</p> |
| | | 19 | | </LayoutView> |
| | | 20 | | </NotFound> |
| | | 21 | | </Router> |
| | | 22 | | |
| | | 23 | | @code { |
| | | 24 | | private ErrorBoundary? _errorBoundary; |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Gets the page title for the NotFound page |
| | | 28 | | /// </summary> |
| | | 29 | | public string GetNotFoundPageTitle() |
| | 34 | 30 | | { |
| | 34 | 31 | | return Constants.Routing.NotFoundPageTitle; |
| | 34 | 32 | | } |
| | | 33 | | |
| | | 34 | | /// <summary> |
| | | 35 | | /// Recovers from an error by resetting the ErrorBoundary |
| | | 36 | | /// </summary> |
| | | 37 | | public void RecoverError() |
| | 16 | 38 | | { |
| | 16 | 39 | | _errorBoundary?.Recover(); |
| | 16 | 40 | | } |
| | | 41 | | } |