Path: redb/redb.Templates/templates/redb-app/RedbApp.Web/Layout/MainLayout.razor
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Templates/templates/redb-app/RedbApp.Web/Layout/MainLayout.razor
----
@inherits LayoutComponentBase
@implements IDisposable
@inject Session Session
@inject NavigationManager Navigation
RedbApp
@if (Session.IsSignedIn)
{
ProductsCategories@Session.Login
}
@Body
@code {
protected override void OnInitialized() => Session.Changed += StateHasChanged;
// Every page except the sign-in page needs a session.
protected override void OnParametersSet()
{
if (!Session.IsSignedIn && !Navigation.Uri.EndsWith("/login", StringComparison.OrdinalIgnoreCase))
Navigation.NavigateTo("login");
}
private void SignOut()
{
Session.SignOut();
Navigation.NavigateTo("login");
}
public void Dispose() => Session.Changed -= StateHasChanged;
}