rest-axios.js 479 B

123456789101112131415
  1. import axios from 'axios'
  2. // https://github.com/alvar0hurtad0/drupal-vuejs-todo/blob/master/frontend/src/api/axiosInterceptor.js
  3. // console.log('drupalSettings', drupalSettings)
  4. // console.log('window.location.origin', window.location.origin)
  5. export const REST = axios.create({
  6. baseURL: window.location.origin + '/' + drupalSettings.path.pathPrefix,
  7. withCredentials: true,
  8. headers: {
  9. // Authorization: 'Bearer {token}',
  10. 'Content-Type': 'application/json'
  11. }
  12. })