|
|
|
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Components;
|
|
|
|
|
using Blazorise;
|
|
|
|
|
using Microsoft.JSInterop;
|
|
|
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace CraftSharp.Services
|
|
|
|
|
{
|
|
|
|
@ -14,6 +15,9 @@ namespace CraftSharp.Services
|
|
|
|
|
{
|
|
|
|
|
private readonly IAuthService _authService;
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
public NavigationManager NavigationManager { get; set; }
|
|
|
|
|
|
|
|
|
|
private CurrentUser _currentUser { get; set; }
|
|
|
|
|
|
|
|
|
|
public CustomStateProvider(IAuthService authService)
|
|
|
|
@ -48,6 +52,7 @@ namespace CraftSharp.Services
|
|
|
|
|
CurrentUser user;
|
|
|
|
|
user = _authService.GetUser(loginParameters.UserName);
|
|
|
|
|
_currentUser = user;
|
|
|
|
|
|
|
|
|
|
NotifyAuthenticationStateChanged(GetAuthenticationStateAsync());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -55,6 +60,7 @@ namespace CraftSharp.Services
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
_currentUser = new CurrentUser();
|
|
|
|
|
|
|
|
|
|
NotifyAuthenticationStateChanged(GetAuthenticationStateAsync());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -65,6 +71,7 @@ namespace CraftSharp.Services
|
|
|
|
|
// No error - Login the user
|
|
|
|
|
var user = _authService.GetUser(registerParameters.UserName);
|
|
|
|
|
_currentUser = user;
|
|
|
|
|
|
|
|
|
|
NotifyAuthenticationStateChanged(GetAuthenticationStateAsync());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|