Blame view

api/dashboard/src/plugins/axios.js 458 Bytes
0d8c0f816   Thanasis Naskos   initial commit
1
2
  import axios from 'axios'
  import store from '~/store'
c0c5f5114   Chris Bellas   Added keycloak fr...
3
  import Vue from 'vue'
0d8c0f816   Thanasis Naskos   initial commit
4
5
6
7
  
  // Request interceptor
  axios.interceptors.request.use(request => {
    request.baseURL = process.env.VUE_APP_BASE_URL
c0c5f5114   Chris Bellas   Added keycloak fr...
8
    request.headers.Authorization = `Bearer ${Vue.prototype.$keycloak.token}`
0d8c0f816   Thanasis Naskos   initial commit
9
10
11
12
13
  
    const locale = store.getters['lang/locale']
    if (locale) {
      request.headers.common['Accept-Language'] = locale
    }
0d8c0f816   Thanasis Naskos   initial commit
14
    return request
c0c5f5114   Chris Bellas   Added keycloak fr...
15
  }, error => {
0d8c0f816   Thanasis Naskos   initial commit
16
17
    return Promise.reject(error)
  })