Better now edit submit behaviour

This commit is contained in:
Gordon Pedersen 2024-06-24 10:40:46 +10:00
parent 57885b4c5e
commit 34caee585f
2 changed files with 15 additions and 6 deletions

View file

@ -25,10 +25,11 @@
</nav> </nav>
@code { @code {
MarkdownEditor Editor; private MarkdownEditor Editor;
bool listed; private bool listed;
string markdownValue; private string markdownValue;
string markdownHtml;
private bool loading = false;
protected override async Task OnInitializedAsync() { protected override async Task OnInitializedAsync() {
await base.OnInitializedAsync(); await base.OnInitializedAsync();
@ -47,6 +48,15 @@
} }
public async Task Save() { public async Task Save() {
await api.PostNowPage(State.SelectedAddressName, markdownValue, listed); loading = true;
await InvokeAsync(StateHasChanged);
var result = await api.PostNowPage(State.SelectedAddressName, markdownValue, listed);
if (result != null) {
await State.RefreshNow();
await InvokeAsync(StateHasChanged);
Nav.NavigateTo($"/person/{State.SelectedAddressName}#now");
}
loading = false;
} }
} }

View file

@ -198,7 +198,6 @@ namespace Neighbourhood.omg.lol {
public async Task<BasicResponseData?> DeletePic(string address, string id) => public async Task<BasicResponseData?> DeletePic(string address, string id) =>
(await Delete<BasicResponseData>($"/address/{address}/pics/{id}")); (await Delete<BasicResponseData>($"/address/{address}/pics/{id}"));
public async Task<PatchStatusResponseData?> PatchStatus(string address, string id, string content, string? emoji) => public async Task<PatchStatusResponseData?> PatchStatus(string address, string id, string content, string? emoji) =>
(await Patch<PatchStatusResponseData, PatchStatus>($"/address/{address}/statuses/", new PatchStatus { Id = id, Content = content, Emoji = emoji })); (await Patch<PatchStatusResponseData, PatchStatus>($"/address/{address}/statuses/", new PatchStatus { Id = id, Content = content, Emoji = emoji }));