|
|
@ -1,4 +1,6 @@
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
using CraftSharp.Services;
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
|
|
|
using Microsoft.AspNetCore.Components.Authorization;
|
|
|
|
using Microsoft.Extensions.Localization;
|
|
|
|
using Microsoft.Extensions.Localization;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -9,6 +11,15 @@ namespace CraftSharp.Shared
|
|
|
|
[Inject]
|
|
|
|
[Inject]
|
|
|
|
public IStringLocalizer<Index> Localizer { get; set; }
|
|
|
|
public IStringLocalizer<Index> Localizer { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
|
|
|
public CustomStateProvider AuthStateProvider { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
|
|
|
|
public NavigationManager NavigationManager { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[CascadingParameter]
|
|
|
|
|
|
|
|
private Task<AuthenticationState> AuthenticationState { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
void goInscription()
|
|
|
|
void goInscription()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
navigationManager.NavigateTo("inscription");
|
|
|
|
navigationManager.NavigateTo("inscription");
|
|
|
@ -18,5 +29,19 @@ namespace CraftSharp.Shared
|
|
|
|
{
|
|
|
|
{
|
|
|
|
navigationManager.NavigateTo("connexion");
|
|
|
|
navigationManager.NavigateTo("connexion");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!(await AuthenticationState).User.Identity.IsAuthenticated)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
NavigationManager.NavigateTo("/inscription");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private async Task LogoutClick()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await AuthStateProvider.Logout();
|
|
|
|
|
|
|
|
NavigationManager.NavigateTo("/inscription");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|