mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 11:11:10 +00:00
Fixes view script loading and request handling on the web frontend
Executes the view scripts after the application scripts have loaded, both on the initial page load and during AJAX navigation, instead of running them during HTML parsing when the API helpers are not defined yet. Sends an empty JSON object for requests without a payload, because FastEndpoints parses the JSON body when the content type is application/json. Adds the antiforgery token to the management views that issue protected write requests.
This commit is contained in:
1 parent
ccefb65c83
commit
ba9a49b0db
14 files changed
+109
-70
No files matched your search
@@ -18,6 +18,8 @@
|
||||
@inject IViewLocalizer _localizer
|
||||
@inject IUrlService _urlService
|
||||
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<form id="authorization-permissions-form" method="post" class="w-100 h-100 mx-auto pl-10 pr-10 pt-10 pb-10">
|
||||
<div id="authorization-permissions-container">
|
||||
<input type="hidden" name="authorization-users-selected-id" id="authorization-users-selected-id" value="" />
|
||||
@@ -101,7 +103,8 @@
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
<!-- The "text/plain" type is a design choice, not a mistake: it keeps the browser from executing this view script during HTML parsing, before site.js defines the API helpers it calls (callApiGetAsync, callApiPostAsync, ...). site.js (which loads deferred) executes these scripts once it is loaded, both on the initial page load and during AJAX navigation. -->
|
||||
<script type="text/plain" data-form="@scriptId">
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
@inject IViewLocalizer _localizer
|
||||
@inject IUrlService _urlService
|
||||
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<form id="authorization-roles-form" method="post" class="w-100 h-100 mx-auto pl-10 pr-10 pt-10 pb-10">
|
||||
<div id="authorization-roles-container">
|
||||
<input type="hidden" name="authorization-roles-selected-id" id="authorization-roles-selected-id" value="" />
|
||||
@@ -81,7 +83,8 @@
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
<!-- The "text/plain" type is a design choice, not a mistake: it keeps the browser from executing this view script during HTML parsing, before site.js defines the API helpers it calls (callApiGetAsync, callApiPostAsync, ...). site.js (which loads deferred) executes these scripts once it is loaded, both on the initial page load and during AJAX navigation. -->
|
||||
<script type="text/plain" data-form="@scriptId">
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
|
||||
@@ -148,7 +148,8 @@
|
||||
</div>
|
||||
</div>
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
<!-- The "text/plain" type is a design choice, not a mistake: it keeps the browser from executing this view script during HTML parsing, before site.js defines the API helpers it calls (callApiGetAsync, callApiPostAsync, ...). site.js (which loads deferred) executes these scripts once it is loaded, both on the initial page load and during AJAX navigation. -->
|
||||
<script type="text/plain" data-form="@scriptId">
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
|
||||
|
||||
@@ -145,7 +145,8 @@
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script type="text/javascript" data-form="@scriptId" defer>
|
||||
<!-- The "text/plain" type is a design choice, not a mistake: it keeps the browser from executing this view script during HTML parsing, before site.js defines the API helpers it calls (callApiGetAsync, callApiPostAsync, ...). site.js (which loads deferred) executes these scripts once it is loaded, both on the initial page load and during AJAX navigation. -->
|
||||
<script type="text/plain" data-form="@scriptId">
|
||||
// create cleanup registry for this view
|
||||
const cleanupFunctions = [];
|
||||
let isInitialized = false;
|
||||
|
||||
Reference in new issue
Block a user