strip unnecessary imports from js app files

This commit is contained in:
Nabeel Shahzad
2018-03-27 18:18:25 -05:00
parent 1518b8d4f7
commit a1a8c6f141
18 changed files with 1508 additions and 299 deletions

View File

@@ -2,38 +2,38 @@
* Bootstrap any Javascript libraries required
*/
window._ = require('lodash')
window.Popper = require('popper.js').default
window.$ = window.jquery = require('jquery')
window.select2 = require('select2')
window.pjax = require('pjax')
window.axios = require('axios')
//window._ = require('lodash')
//window.Popper = require('popper.js').default;
//window.$ = window.jquery = require('jquery');
//window.select2 = require('select2');
//window.pjax = require('pjax');
window.axios = require('axios');
/**
* Container for phpVMS specific functions
*/
window.phpvms = {}
window.phpvms = {};
/**
* Configure Axios with both the csrf token and the API key
*/
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'
const token = document.head.querySelector('meta[name="csrf-token"]')
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
const token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content
window.jquery.ajaxSetup({
/*window.jquery.ajaxSetup({
'X-CSRF-TOKEN': token.content
})
})*/
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token')
}
const api_key = document.head.querySelector('meta[name="api-key"]')
const api_key = document.head.querySelector('meta[name="api-key"]');
if (api_key) {
window.axios.defaults.headers.common['x-api-key'] = api_key.content
window.axios.defaults.headers.common['x-api-key'] = api_key.content;
window.PHPVMS_USER_API_KEY = api_key.content
} else {
window.PHPVMS_USER_API_KEY = false
window.PHPVMS_USER_API_KEY = false;
console.error('API Key not found!')
}