2024-06-14 07:20:04 +00:00
|
|
|
@page "/sharetext/{Text}"
|
2024-06-18 01:58:51 +00:00
|
|
|
@inject NavigationManager navigationManager
|
|
|
|
@inject AuthenticationStateProvider AuthStateProvider
|
2024-06-14 07:20:04 +00:00
|
|
|
|
2024-06-18 01:58:51 +00:00
|
|
|
<PageHeading title="Status.lol" icon="fa-solid fa-message-smile">
|
|
|
|
<Description>Share a post to <a href="https://status.lol">status.lol</a></Description>
|
|
|
|
</PageHeading>
|
2024-06-14 07:20:04 +00:00
|
|
|
|
2024-06-18 01:58:51 +00:00
|
|
|
<AuthorizeView>
|
|
|
|
<Authorized>
|
|
|
|
<button class="fab circle extra large-elevate" data-ui="#post-modal">
|
|
|
|
<i class="fa-solid fa-pen-to-square"></i>
|
|
|
|
</button>
|
|
|
|
<NewStatusDialog id="post-modal" Active="true" Content="@Text"></NewStatusDialog>
|
|
|
|
</Authorized>
|
|
|
|
</AuthorizeView>
|
2024-06-14 07:20:04 +00:00
|
|
|
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
|
|
public string Text { get; set; }
|
2024-06-18 01:58:51 +00:00
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync() {
|
|
|
|
await checkLogin();
|
|
|
|
}
|
|
|
|
|
|
|
|
// protected override async Task OnAfterRenderAsync(bool firstRender) {
|
|
|
|
// await base.OnAfterRenderAsync(firstRender);
|
|
|
|
// if (firstRender && await checkLogin()) {
|
|
|
|
// await JS.InvokeVoidAsync("focusText");
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
private async Task<bool> checkLogin() {
|
|
|
|
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
|
|
|
|
var user = authState.User;
|
|
|
|
|
|
|
|
if (user.Identity is not null && user.Identity.IsAuthenticated) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
navigationManager.NavigateTo("/login");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2024-06-14 07:20:04 +00:00
|
|
|
}
|