How to use the formdata in the client request method?
Data ultimo post: 04 set 2023
I making an API calls inside the SDK application with the Axios POST method and Formdata, you can in the below code.
const axios = require('axios');
const FormData = require('form-data');
let data = new FormData();
data.append('username', 'balu');
data.append('key', jhjjjjhjjjhh');
data.append('email', 'anish.k@spritle.com');
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://opencart.ajithr.com/index.php?route=zendesk/customer',
headers: {
'Content-Type': 'application/json',
'Cookie': 'OCSESSID=0c4898f4cd2a443a21c3fb3324; currency=USD',
...data.getHeaders()
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
How can I change this Axios method into a client method?
I documentation also can't able to find it.
Thanks in advance.
1
12
12 commenti
Accedi per aggiungere un commento.