Change all the forms from _method to X-HTTP-Method-Override
This commit is contained in:
@@ -248,7 +248,7 @@ if (isset($this->jsScriptLoadData['activateCompany'])) { ?>
|
||||
const params = {
|
||||
company_uuid: companyUuid,
|
||||
company_state: newState,
|
||||
_method: 'PUT'
|
||||
"X-HTTP-Method-Override": "PUT"
|
||||
};
|
||||
|
||||
const rootStyles = getComputedStyle(document.documentElement);
|
||||
@@ -641,7 +641,7 @@ if (isset($this->jsScriptLoadData['stompjes'])) { ?>
|
||||
// Make the POST request to delete the device
|
||||
$.post(apiUrl, {
|
||||
[itemName]: itemUuid,
|
||||
_method: "POST"
|
||||
"X-HTTP-Method-Override": "POST"
|
||||
})
|
||||
|
||||
.done(function (response) {
|
||||
@@ -712,7 +712,7 @@ if (isset($this->jsScriptLoadData['stompjes'])) { ?>
|
||||
// Make the POST request to delete the device
|
||||
$.post(deleteStompOptions.apiUrl, {
|
||||
[deleteStompOptions.itemName]: deleteStompOptions.itemUuid,
|
||||
_method: "DELETE"
|
||||
"X-HTTP-Method-Override": "DELETE"
|
||||
})
|
||||
|
||||
.done(function (response) {
|
||||
@@ -963,7 +963,7 @@ if (isset($this->jsScriptLoadData['delete_confirmation'])) { ?>
|
||||
// Make the POST request to delete the item
|
||||
$.post(apiUrl, {
|
||||
[itemName]: itemUuid,
|
||||
_method: "DELETE"
|
||||
"X-HTTP-Method-Override": "DELETE"
|
||||
})
|
||||
.done(function (response) {
|
||||
|
||||
@@ -1154,7 +1154,7 @@ if (isset($this->jsScriptLoadData['updateToggle'])) { ?>
|
||||
}
|
||||
|
||||
// Add method override
|
||||
dataObj._method = 'PUT';
|
||||
dataObj['X-HTTP-Method-Override'] = 'PUT';
|
||||
|
||||
// Convert to URL-encoded string
|
||||
const formBody = new URLSearchParams(dataObj).toString();
|
||||
@@ -1169,8 +1169,8 @@ if (isset($this->jsScriptLoadData['updateToggle'])) { ?>
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
// Remove _method before saving back
|
||||
delete dataObj._method;
|
||||
// Remove X-HTTP-Method-Override before saving back
|
||||
delete dataObj['X-HTTP-Method-Override']
|
||||
input.setAttribute('data-api-data', JSON.stringify(dataObj));
|
||||
} else {
|
||||
input.checked = !input.checked; // revert toggle
|
||||
@@ -1209,7 +1209,7 @@ if (isset($this->jsScriptLoadData['updatePermissions'])) { ?>
|
||||
formData.append('permission_uuid', permissionUUID);
|
||||
formData.append('user_group_uuid', userGroupUUID);
|
||||
formData.append('permission_value', permissionValue);
|
||||
formData.append('_method', 'PUT')
|
||||
formData.append('X-HTTP-Method-Override', 'PUT')
|
||||
|
||||
try {
|
||||
const response = await fetch(apiUrl, {
|
||||
|
||||
Reference in New Issue
Block a user