Blame view

api/dashboard/src/plugins/axios.js 630 Bytes
0d8c0f816   Thanasis Naskos   initial commit
1
2
3
4
5
6
  import axios from 'axios'
  import store from '~/store'
  
  // Request interceptor
  axios.interceptors.request.use(request => {
    request.baseURL = process.env.VUE_APP_BASE_URL
25df08e6c   Chris Bellas   Merged changes fr...
7
8
9
10
    // const token = store.getters['auth/token']
    // if (token) {
    //   request.headers.common.Authorization = `Bearer ${token}`
    // }
0d8c0f816   Thanasis Naskos   initial commit
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  
    const locale = store.getters['lang/locale']
    if (locale) {
      request.headers.common['Accept-Language'] = locale
    }
  
    // request.headers['X-Socket-Id'] = Echo.socketId()
  
    return request
  })
  
  // Response interceptor
  axios.interceptors.response.use(response => response, error => {
    return Promise.reject(error)
  })