Skip to content
Snippets Groups Projects
Commit 6b352c8a authored by Lucas Eduardo Schoenfelder's avatar Lucas Eduardo Schoenfelder
Browse files

fix post/put error 500

parent 51de6013
No related branches found
No related tags found
6 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!39Update admin system,!32Homologa,!31Fix console error,!30Centraliza axios
......@@ -33,6 +33,7 @@ function fetchHeaders () {
if (auth_headers) {
const myHeaders = new Headers(auth_headers)
myHeaders.append('Content-Type', 'application/json')
return myHeaders
}
else {
......@@ -119,15 +120,10 @@ export const axiosDeleteRequest = (url, onSuccess, onError) => {
}
export const axiosPutRequest = (url, payload, onSuccess, onError) => {
let formData = new FormData()
for (const [key, value] of Object.entries(payload)) {
formData.append(`${key}`,value);
}
fetch((`${apiUrl}${url}`), {
method : 'PUT',
headers : fetchHeaders(),
body: formData
body: JSON.stringify(payload)
})
.then(response => {
if (response.headers.has('access-token')) {
......@@ -145,15 +141,10 @@ export const axiosPutRequest = (url, payload, onSuccess, onError) => {
}
export const axiosPostRequest = (url, payload, onSuccess, onError) => {
let formData = new FormData()
for (const [key, value] of Object.entries(payload)) {
formData.append(`${key}`,value);
}
fetch((`${apiUrl}${url}`), {
method : 'POST',
headers : fetchHeaders(),
body: formData
body: JSON.stringify(payload)
})
.then(response => {
if (response.headers.has('access-token')) {
......@@ -213,7 +204,6 @@ export const authentication = (url, payload, onSuccess, onError) => {
fetch((`${apiUrl}${url}`), {
method : 'POST',
headers : fetchHeaders(),
body: formData
})
.then(response => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment