Skip to content

Commit

Permalink
feat: add confirmation message to question submit form
Browse files Browse the repository at this point in the history
  • Loading branch information
liamgold committed Aug 21, 2024
1 parent fd8d86b commit dfa0f6a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,23 @@ public async Task<IActionResult> CreateQuestion(QAndAQuestionFormSubmissionViewM
var questionsParent = await mediator.Send(new QAndAQuestionsRootPageQuery(channelContext.WebsiteChannelName));
var questionMonthFolder = await mediator.Send(new QAndAMonthFolderQuery(questionsParent, channelContext.WebsiteChannelName, now.Year, now.Month, channelContext.WebsiteChannelID));

return await mediator.Send(new QAndAQuestionCreateCommand(
var result = await mediator.Send(new QAndAQuestionCreateCommand(
member,
questionMonthFolder,
channelContext.WebsiteChannelID,
requestModel.Title,
requestModel.Content,
SystemTaxonomies.QAndADiscussionTypeTaxonomy.QuestionTag.GUID,
Maybe<BlogPostPage>.None))
.Match(_ =>
{
Response.Htmx(h => h.Redirect("/q-and-a"));
Maybe<BlogPostPage>.None));

return Ok();
}, LogAndReturnError("CREATE_QUESTION"));
if (result.IsSuccess)
{
return PartialView("~/Features/QAndA/Components/Form/QAndAQuestionFormConfirmation.cshtml");
}
else
{
return LogAndReturnError("CREATE_QUESTION")(result.Error);
}
}

[HttpPost]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="alert alert-success" role="alert">
Your question has been successfully submitted!<br><br>
It may take a few moments for the <a href="/q-and-a">Q&A listing</a> to update, don't worry if you don't see it
right away.
</div>

0 comments on commit dfa0f6a

Please sign in to comment.