Guest User

Untitled

a guest
Nov 19th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. import axios from 'axios'
  2. import qs from 'qs'
  3.  
  4. const axiosInstance = axios.create({
  5. transformRequest: [function(data) {
  6. return qs.stringify(data);
  7. }],
  8. headers:{
  9. 'Content-Type': 'application/x-www-form-urlencoded'
  10. }
  11. })
  12.  
  13. // Send a POST request
  14. axiosInstance({
  15. method: 'post',
  16. url: '/demo/12345',
  17. data: {
  18. key1: 'value1',
  19. key2: 'value2'
  20. }
  21. }).then(function(response) {
  22. console.log(response)
  23. })
  24. .catch(function(error) {
  25. console.log(error)
  26. })
Add Comment
Please, Sign In to add comment