71 lines
2.1 KiB
C#
71 lines
2.1 KiB
C#
using Blazorise;
|
|
using FoodsharingSiegen.Contracts.Entity;
|
|
using FoodsharingSiegen.Server.Auth;
|
|
using FoodsharingSiegen.Server.Data;
|
|
using FoodsharingSiegen.Server.Data.Service;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace FoodsharingSiegen.Server.BaseClasses
|
|
{
|
|
/// <summary>
|
|
/// The fs base class (a. beging, 08.04.2022)
|
|
/// </summary>
|
|
/// <seealso cref="ComponentBase"/>
|
|
public class FsBase : ComponentBase
|
|
{
|
|
#region Override OnInitializedAsync
|
|
|
|
/// <summary>
|
|
/// Ons the initialized (a. beging, 11.04.2022)
|
|
/// </summary>
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await AuthService!.Initialize();
|
|
await base.OnInitializedAsync();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Dependencies (Injected)
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the auth service (ab)
|
|
/// </summary>
|
|
[Inject] private AuthService? AuthService { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the audit service (ab)
|
|
/// </summary>
|
|
[Inject] private AuditService? AuditService { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the notification (ab)
|
|
/// </summary>
|
|
[Inject] protected INotificationService? Notification { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the message (ab)
|
|
/// </summary>
|
|
[Inject] protected IMessageService? Message { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the value of the navigation manager (ab)
|
|
/// </summary>
|
|
[Inject] protected NavigationManager? NavigationManager { get; set; }
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// Refreshes the state (a. beging, 21.05.2022)
|
|
/// </summary>
|
|
protected async Task RefreshState()
|
|
{
|
|
await AuthService?.RefreshState()!;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the value of the current user (ab)
|
|
/// </summary>
|
|
protected User CurrentUser => AuthService?.User ?? new User();
|
|
}
|
|
} |