rest-axios.js 785 B

1234567891011121314151617181920212223242526
  1. import axios from 'axios'
  2. // TODO: make this one as settings (or find an other solution)
  3. // https://dev.to/sanfra1407/how-to-use-env-file-in-javascript-applications-with-webpack-18df
  4. // switch (app_env) {
  5. // case 'dev':
  6. // let path = `http://${window.location.hostname}:8984`
  7. // break;
  8. // case 'prod':
  9. // let path = `http://${window.location.hostname}/api`
  10. // break;
  11. // }
  12. // let path = 'http://dev.api.gdp.fr'
  13. // let path = 'http://localhost:8984'
  14. // const
  15. // let path = 'http://' + window.location.hostname + (window.env === 'prod' ? '/api' : ':8984')
  16. export const REST = axios.create({
  17. // baseURL: 'http://',
  18. // withCredentials: true,
  19. crossorigin: true,
  20. headers: {
  21. 'Accept': 'application/json'
  22. // 'Access-Control-Allow-Credentials': true
  23. }
  24. })