@inject IJSRuntime JS @inject State State @inject RestService api @inject NavigationManager navigationManager
Share your status
@code { [Parameter] public string? id { get; set; } [Parameter] public bool Active { get; set; } [Parameter] public string Content { get; set; } = string.Empty; [Parameter] public string? Emoji { get; set; } = null; [Parameter] public bool postToMastodon { get; set; } = true; private bool loading = false; public async Task PostStatus() { StatusPost post = new StatusPost { Emoji = Emoji, Content = Content }; if (State?.SelectedAddress?.Preferences?.Statuslog?.MastodonPosting ?? false){ post.SkipMastodonPost = !postToMastodon; } loading = true; await InvokeAsync(StateHasChanged); var result = await api.StatusPost(State!.SelectedAddressName!, post); if(result != null){ await State.RefreshStatuses(); State.SendRefresh(); await InvokeAsync(StateHasChanged); // navigationManager.NavigateTo("/statuslog/latest"); } this.Active = false; await JS.InvokeVoidAsync("ui", "#" + id); Content = string.Empty; Emoji = null; postToMastodon = true; loading = false; } }