添加项目文件。
This commit is contained in:
26
TechHelper.Client/Pages/AuthLinks.razor
Normal file
26
TechHelper.Client/Pages/AuthLinks.razor
Normal file
@@ -0,0 +1,26 @@
|
||||
@inject IAuthenticationClientService AuthenticationClientService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<MudText>
|
||||
Hello, @context.User.Identity.Name!
|
||||
</MudText>
|
||||
<MudButton OnClick="Logout"> LOGOUT </MudButton>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<MudButton Class="" Href="Register"> Register </MudButton>
|
||||
<MudButton Class="" Href="Login"> Login </MudButton>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
private async Task Logout()
|
||||
{
|
||||
await AuthenticationClientService.LogoutAsync();
|
||||
NavigationManager.NavigateTo("/");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user