Browse Source

Use X-HTTP-Method-Override for all MfH pages

tags/3.1.0
Mike Koch 2 years ago
parent
commit
454013fd98
2 changed files with 28 additions and 4 deletions
  1. 18
    0
      internal-api/js/api-settings.js
  2. 10
    4
      internal-api/js/manage-custom-nav-elements.js

+ 18
- 0
internal-api/js/api-settings.js View File

@@ -96,6 +96,24 @@ function generateToken(userId) {
});
}

function markSuccess(id) {
$('#' + id + '-saving').addClass('hide');
$('#' + id + '-failure').addClass('hide');
$('#' + id + '-success').removeClass('hide');
}

function markSaving(id) {
$('#' + id + '-saving').removeClass('hide');
$('#' + id + '-failure').addClass('hide');
$('#' + id + '-success').addClass('hide');
}

function markFailure(id) {
$('#' + id + '-saving').addClass('hide');
$('#' + id + '-failure').removeClass('hide');
$('#' + id + '-success').addClass('hide');
}

function clearTokens(userId) {
var heskPath = $('p#hesk-path').text();
var endpoint = heskPath + 'internal-api/admin/api-authentication/';

+ 10
- 4
internal-api/js/manage-custom-nav-elements.js View File

@@ -94,9 +94,12 @@ $(document).ready(function() {
$modal.find('#action-buttons').find('.save-button').attr('disabled', 'disabled');

$.ajax({
method: method,
method: 'POST',
url: url,
headers: { 'X-Internal-Call': true },
headers: {
'X-Internal-Call': true,
'X-HTTP-Method-Override': method
},
data: JSON.stringify(data),
success: function(data) {
if (id === -1) {
@@ -310,9 +313,12 @@ function bindDeleteButton() {
var element = elements[$(this).parent().parent().find('[data-property="id"]').text()];

$.ajax({
method: 'DELETE',
method: 'POST',
url: heskUrl + 'api/index.php/v1-internal/custom-navigation/' + element.id,
headers: { 'X-Internal-Call': true },
headers: {
'X-Internal-Call': true,
'X-HTTP-Method-Override': 'DELETE'
},
success: function() {
mfhAlert.success(mfhLang.text('custom_nav_element_deleted'));
loadTable();

Loading…
Cancel
Save