81 lines
2.2 KiB
Plaintext
81 lines
2.2 KiB
Plaintext
@inherits LayoutComponentBase
|
|
@using AyCode.Interfaces.StorageHandlers;
|
|
@using AyCode.Services.Loggers
|
|
@using Newtonsoft.Json;
|
|
@using TIAMSharedUI.Pages
|
|
@using TIAMSharedUI.Shared.Components
|
|
@using TIAMWebApp.Shared.Application.Interfaces
|
|
@using TIAMWebApp.Shared.Application.Models.ClientSide;
|
|
@using AyCode.Blazor.Components;
|
|
@using TIAMWebApp.Shared.Application.Models;
|
|
@using TIAMWebApp.Shared.Application.Utility;
|
|
@using System.IdentityModel.Tokens.Jwt;
|
|
@using TIAM.Core.Loggers;
|
|
@inject NavigationManager NavManager
|
|
@inject IJSRuntime jsRuntime
|
|
@inject ISecureStorageHandler SecureStorageHandler
|
|
@inject ISessionService sessionService
|
|
@inject IEnumerable<IAcLogWriterClientBase> LogWriters
|
|
|
|
|
|
|
|
<!--div-- class="page"-->
|
|
<div>
|
|
|
|
<TiamErrorBoundaryComponent OnError="HandleError">
|
|
<AppLaunchComponent />
|
|
|
|
<Navbar />
|
|
<!--div class="my-sidebar">
|
|
<NavMenu />
|
|
</div-->
|
|
|
|
<main>
|
|
<article class="content">
|
|
<CascadingValue Value=PopupMessageBox>
|
|
@Body
|
|
</CascadingValue>
|
|
</article>
|
|
</main>
|
|
@* <div class="footer">
|
|
</div> *@
|
|
<FooterComponent></FooterComponent>
|
|
<PopupMessageBox @ref="PopupMessageBox" />
|
|
</TiamErrorBoundaryComponent>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
@code {
|
|
|
|
public PopupMessageBox PopupMessageBox { get; private set; } = default!;
|
|
ILogger _logger;
|
|
|
|
|
|
private void HandleError(Exception exception)
|
|
{
|
|
// Log the error to server
|
|
LogErrorToServer(exception);
|
|
|
|
// Show a notification on UI
|
|
ShowErrorNotification("An unexpected error occurred. Please try again later.");
|
|
|
|
jsRuntime.InvokeVoidAsync("console.error", $"An error occurred: {exception.Message}");
|
|
jsRuntime.InvokeVoidAsync("console.warn", $"Error details: {exception.StackTrace}");
|
|
_logger.Info($"An error occurred: {exception.Message}");
|
|
}
|
|
|
|
private void LogErrorToServer(Exception exception)
|
|
{
|
|
//_logger.Error($"An error occurred: {exception.Message}");
|
|
}
|
|
|
|
private void ShowErrorNotification(string message)
|
|
{
|
|
jsRuntime.InvokeVoidAsync("alert", message);
|
|
}
|
|
|
|
}
|