@inject IJSRuntime JS @inject State State
Share your status
@code { private string statusContent = string.Empty; private string? statusEmoji = null; private bool postToMastodon = true; private bool loading = false; [Parameter] public string id { get; set; } public async Task PostStatus() { await JS.InvokeVoidAsync("console.log", "hey from post status"); StatusPost post = new StatusPost { Emoji = statusEmoji, Content = statusContent }; if (State?.SelectedAddress?.Preferences?.Statuslog?.MastodonPosting ?? false){ post.SkipMastodonPost = !postToMastodon; } loading = true; InvokeAsync(StateHasChanged); RestService api = new RestService(); var result = await api.StatusPost(State.SelectedAddressName, post); if(result != null){ State.RefreshStatuses().ContinueWith(t => InvokeAsync(StateHasChanged)); } await JS.InvokeVoidAsync("ui", "#" + id); statusContent = string.Empty; statusEmoji = null; postToMastodon = true; loading = false; } }