redirect after create fails
Not sure if I have done something wrong or if there is a setting I have missed. I grabbed your master branch and it is doing the same.
Repro:
- Open project
- Select Student
- Click Create New
- Enter valid details
- Click Save
The redirect triggers and you now see json on the page: {"redirect":"/Students"} on the URL: https://localhost:44375/Students/Create
I would have expected to navigate back to the Student Index page.
The code that does the redirect is in "wwwroot/js/site.js" so if you're creating a new project, you will want to add this as the "return this.RedirectToPageJson("Index");" uses it to do the redirect.
See pic below...
Take note that bootstrap was updated to v4 in this latest code so classes like "has-error" are gone and I now get flashing for validation but I just comment out the @Html.ValidationDiv() and go back to the original validation.
As I work my way thru learning this new architecture (which I like very much!!!) ... I'll see if I an fix it and make a PR for others running into this issue.
This works for me for now
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
@* @Html.ValidationDiv() *@
Something in this method or sub-methods was throwing an error stating that it could not find _.reject(). I found this by adding the alert statement to the catch.
var highlightErrors = function (xhr) {
try {
var data = JSON.parse(xhr.responseText);
highlightFields(data);
showSummary(data);
window.scrollTo(0, 0);
} catch (e) {
alert(e);
// (Hopefully) caught by the generic error handler in `config.js`.
}
};
To fix this, I had to replace the following.
<script src="~/lib/lodash/dist/core.js"></script>
with this
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
Hope this helps.