Moved to _dev
This commit is contained in:
31
crater/resources/scripts/plugins/axios.js
Normal file
31
crater/resources/scripts/plugins/axios.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import axios from 'axios'
|
||||
import Ls from '@/scripts/services/ls.js'
|
||||
|
||||
window.Ls = Ls
|
||||
window.axios = axios
|
||||
axios.defaults.withCredentials = true
|
||||
|
||||
axios.defaults.headers.common = {
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
}
|
||||
|
||||
/**
|
||||
* Interceptors
|
||||
*/
|
||||
|
||||
axios.interceptors.request.use(function (config) {
|
||||
// Pass selected company to header on all requests
|
||||
const companyId = Ls.get('selectedCompany')
|
||||
|
||||
const authToken = Ls.get('auth.token')
|
||||
|
||||
if (authToken) {
|
||||
config.headers.common.Authorization = authToken
|
||||
}
|
||||
|
||||
if (companyId) {
|
||||
config.headers.common['company'] = companyId
|
||||
}
|
||||
|
||||
return config
|
||||
})
|
||||
9
crater/resources/scripts/plugins/i18n.js
Normal file
9
crater/resources/scripts/plugins/i18n.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import { createI18n } from 'vue-i18n'
|
||||
|
||||
export default (messages) => {
|
||||
return createI18n({
|
||||
locale: 'en',
|
||||
fallbackLocale: 'en',
|
||||
messages
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user