Skip to content

Commit

Permalink
Use post method for patch and delete requests with _method parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdekruijk committed Dec 24, 2019
1 parent e9eb45a commit c00d665
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/js/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ function mediaDestroy(slug, target) {
if (confirm($(target).data('confirm')+' '+filename+'?')) {
loading();
$.ajax('media/'+slug+'/'+mediaFolder(), {
method: 'delete',
data: 'filename='+encodeURIComponent(filename),
method: 'post',
data: '_method=delete&filename='+encodeURIComponent(filename),
cache: 'false',
}).done(function(data,status,xhr) {
$(target).parent().fadeOut();
Expand All @@ -70,8 +70,8 @@ function mediaRename(slug, target) {
if (newname = prompt($(target).data('prompt')+' '+filename, filename)) {
loading();
$.ajax('media/'+slug+'/'+mediaFolder(), {
method: 'patch',
data: 'filename='+encodeURIComponent(filename)+'&newname='+encodeURIComponent(newname),
method: 'post',
data: '_method=patch&filename='+encodeURIComponent(filename)+'&newname='+encodeURIComponent(newname),
cache: 'false',
}).done(function(data,status,xhr) {
if (data) {
Expand Down Expand Up @@ -110,7 +110,8 @@ function mediaDeleteFolder(slug, target) {
if (confirm($(target).data('confirm')+'?')) {
loading();
$.ajax('media/'+slug+'/'+mediaFolder()+'/folder', {
method: 'delete',
method: 'post',
data: '_method=delete',
cache: 'false',
}).done(function(data,status,xhr) {
$('#listview LI.active').detach();
Expand Down

0 comments on commit c00d665

Please sign in to comment.