[frontend] cleanup
This commit is contained in:
parent
a36a48bf34
commit
46d9fef403
1 changed files with 0 additions and 40 deletions
|
@ -1,40 +0,0 @@
|
||||||
@page "/"
|
|
||||||
@attribute [Authorize]
|
|
||||||
@using Iceshrimp.Frontend.Core.Services
|
|
||||||
@using Microsoft.AspNetCore.Authorization
|
|
||||||
@using Microsoft.AspNetCore.Components.Authorization
|
|
||||||
@inject SessionService Session
|
|
||||||
@inject NavigationManager Navigation
|
|
||||||
<h3>Timeline</h3>
|
|
||||||
@if (_username != null)
|
|
||||||
{
|
|
||||||
<span>You are logged in as @_username </span>
|
|
||||||
<AuthorizeView>
|
|
||||||
<p>Authorization says you are @context.User.Identity!.Name</p>
|
|
||||||
</AuthorizeView>
|
|
||||||
<button @onclick="Logout">Logout</button>
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
<span>Not logged in</span>
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private string? _username;
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
|
||||||
{
|
|
||||||
if (Session.Current != null)
|
|
||||||
{
|
|
||||||
_username = Session.Current.Username;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Logout()
|
|
||||||
{
|
|
||||||
Session.EndSession();
|
|
||||||
Navigation.NavigateTo("/login");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue