68 lines
2.2 KiB
C#
68 lines
2.2 KiB
C#
using AyCode.Services.Loggers;
|
|
using Microsoft.AspNetCore.Components;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using TIAM.Core.Loggers;
|
|
using TIAMSharedUI.Shared.Components;
|
|
using TIAMWebApp.Shared.Application.Interfaces;
|
|
using TIAMWebApp.Shared.Application.Utility;
|
|
|
|
namespace TIAMSharedUI.Pages.Components
|
|
{
|
|
public partial class AuthComponent : ComponentBase
|
|
{
|
|
[Inject]
|
|
public required IEnumerable<IAcLogWriterClientBase> LogWriters { get; set; }
|
|
|
|
[Inject]
|
|
public ISessionService sessionService { get; set; }
|
|
public bool IsLoggedIn = false;
|
|
[Inject]
|
|
public IComponentUpdateService componentUpdateService { get; set; }
|
|
|
|
[CascadingParameter]
|
|
private PopupMessageBox PopupMessageBox { get; set; } = default!;
|
|
|
|
public bool IsVisible = false;
|
|
private ILogger _logger;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
_logger = new LoggerClient<AuthComponent>(LogWriters.ToArray());
|
|
_logger.Debug("OnInitializedAsync");
|
|
|
|
IsLoggedIn = sessionService.IsAuthenticated;
|
|
if(IsLoggedIn)
|
|
{
|
|
|
|
//string sessionMessage = sessionService.User?.UserModelDto.Products.FirstOrDefault()?.Name ?? string.Empty;
|
|
//await PopupMessageBox.ShowAsync("Session info", sessionMessage, null, null, null, PopupMessageBox.ButtonOk);
|
|
}
|
|
|
|
//if (await PopupMessageBox.Show("Cancel", "Cancel this stuff",
|
|
//PopupMessageBox.ButtonNo, PopupMessageBox.ButtonYes) == PopupMessageBox.ButtonNo)
|
|
//{
|
|
//Something is cancelled
|
|
//args.Cancel = true;
|
|
//}
|
|
componentUpdateService.CallRequestRefresh<Navbar>();
|
|
StateHasChanged();
|
|
|
|
//throw new NotImplementedException();
|
|
}
|
|
|
|
protected override void OnAfterRender(bool firstRender)
|
|
{
|
|
base.OnAfterRender(firstRender);
|
|
}
|
|
|
|
private void ToggleAuthComponent(Microsoft.AspNetCore.Components.Web.MouseEventArgs e)
|
|
{
|
|
IsVisible = false;
|
|
}
|
|
}
|
|
}
|