registerAuthEngine.js 414 B

1234567891011121314151617181920
  1. import axios from 'axios'
  2. const TOKEN_KEY = 'eiruAutomation'
  3. /**
  4. *
  5. */
  6. const init = () => {
  7. const token = localStorage.getItem(TOKEN_KEY)
  8. if (!token) {
  9. return
  10. }
  11. axios.defaults.headers.common['Accept'] = 'application/json'
  12. axios.defaults.headers.common['Content-Type'] = 'application/json'
  13. axios.defaults.headers.common['Authorization'] = `JWT ${token}`
  14. }
  15. export default init