Skip to content

Instantly share code, notes, and snippets.

@jonhilt
Created July 1, 2020 13:16
Show Gist options
  • Save jonhilt/7709894fe114dfd6db64a0fcd2956fcc to your computer and use it in GitHub Desktop.
Save jonhilt/7709894fe114dfd6db64a0fcd2956fcc to your computer and use it in GitHub Desktop.
protected async Task HandleValidSubmit()
{
var response = await Http.PostAsJsonAsync("api/post", Command);
if (response.StatusCode == HttpStatusCode.BadRequest)
{
var result = await response.Content.ReadFromJsonAsync<CommandResult>();
CustomValidator?.DisplayErrors(result.Errors);
}
else
{
NavigationManager.NavigateTo($"/{Command.Slug}");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment