Answers for "method patch not working laravel reactjs"

0

method patch not working laravel reactjs

Sad but true, when requesting from the browser it happens that Laravel doesn't properly answer to PATCH or PUT requests.

A quick solution might be using a POST and adding _method: PATCH as post parameter.

Please try with this updated code

let data = new FormData();
data.append("_method", 'PATCH');
 
// append another data ....

const headers = { 
  'Content-Type': 'multipart/form-data',
  'enctype' : 'multipart/form-data',
  'Authorization' : 'Bearer ' + token 
}

axios({
  method : "POST",
  baseURL: this.baseURL,
  url    : url,
  params : params,
  data   : data,
  headers: headers,
}).then(response => {
  return response
})
Posted by: Guest on February-27-2021

Code answers related to "method patch not working laravel reactjs"

Code answers related to "Javascript"

Browse Popular Code Answers by Language