Neighbourhood.omg.lol/Components/Routes.razor

42 lines
1.5 KiB
Text
Raw Permalink Normal View History

@using Microsoft.AspNetCore.Components.Authorization
@inject NavigationManager navigationManager
<Router AppAssembly="@typeof(MauiProgram).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(Layout.MainLayout)">
2024-06-24 01:40:24 +00:00
<Authorizing>
<div class="no-border responsive max no-padding center-align middle-align">
<div class="padding">
<img src="/img/prami-neighbourhood.svg" class="extra" />
</div>
</div>
</Authorizing>
<NotAuthorized><RedirectToLogin /></NotAuthorized>
</AuthorizeRouteView>
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<CascadingAuthenticationState>
<LayoutView Layout="@typeof(Layout.MainLayout)">
2024-06-24 01:40:24 +00:00
<div class="no-border responsive max no-padding center-align middle-align">
<div class="padding">
<img src="/img/prami-neighbourhood.svg" class="extra" />
<p>Sorry, you seem to have landed nowhere.</p>
<small>@navigationManager.Uri</small>
</div>
</div>
</LayoutView>
</CascadingAuthenticationState>
</NotFound>
2024-05-30 01:06:08 +00:00
</Router>
@code
{
protected override void OnAfterRender(bool firstRender) {
string? shareString = Preferences.Get("shareString", null);
if (!string.IsNullOrWhiteSpace(shareString)) {
Preferences.Remove("shareString");
navigationManager.NavigateTo($"/sharetext/{shareString}");
}
}
}