Configure axios library and read the api-key dynamically

This commit is contained in:
Nabeel Shahzad 2018-03-12 20:14:55 -05:00
parent 0f9ce8bbb9
commit 1896e1cc35
11 changed files with 1655 additions and 46 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1105,7 +1105,7 @@ eval("/* WEBPACK VAR INJECTION */(function($) {\nvar jquery = __webpack_require_
/***/ "./resources/js/bootstrap.js": /***/ "./resources/js/bootstrap.js":
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
eval("/**\n * Bootstrap any Javascript libraries required\n */\n\nwindow._ = __webpack_require__(\"./node_modules/lodash/lodash.js\");\nwindow.Popper = __webpack_require__(\"./node_modules/popper.js/dist/esm/popper.js\").default;\nwindow.$ = window.jquery = __webpack_require__(\"./node_modules/jquery/dist/jquery.js\");\nwindow.select2 = __webpack_require__(\"./node_modules/select2/dist/js/select2.js\");\nwindow.pjax = __webpack_require__(\"./node_modules/pjax/index.js\");\n\n// Container for phpVMS specific functions\nwindow.phpvms = {};\n\n/**\n * Configure Axios\n */\nwindow.axios = __webpack_require__(\"./node_modules/axios/index.js\");\nwindow.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';\nvar token = document.head.querySelector('meta[name=\"csrf-token\"]');\n\nif (token) {\n window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;\n} else {\n console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvanMvYm9vdHN0cmFwLmpzPzBlNTgiXSwibmFtZXMiOlsid2luZG93IiwiXyIsInJlcXVpcmUiLCJQb3BwZXIiLCJkZWZhdWx0IiwiJCIsImpxdWVyeSIsInNlbGVjdDIiLCJwamF4IiwicGhwdm1zIiwiYXhpb3MiLCJkZWZhdWx0cyIsImhlYWRlcnMiLCJjb21t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6IiJ9\n//# sourceURL=webpack-internal:///./resources/js/bootstrap.js\n"); eval("/**\n * Bootstrap any Javascript libraries required\n */\n\nwindow._ = __webpack_require__(\"./node_modules/lodash/lodash.js\");\nwindow.Popper = __webpack_require__(\"./node_modules/popper.js/dist/esm/popper.js\").default;\nwindow.$ = window.jquery = __webpack_require__(\"./node_modules/jquery/dist/jquery.js\");\nwindow.select2 = __webpack_require__(\"./node_modules/select2/dist/js/select2.js\");\nwindow.pjax = __webpack_require__(\"./node_modules/pjax/index.js\");\nwindow.axios = __webpack_require__(\"./node_modules/axios/index.js\");\n\n/**\n * Configure Axios with both the csrf token and the API key\n */\nwindow.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';\nvar token = document.head.querySelector('meta[name=\"csrf-token\"]');\n\nif (token) {\n window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;\n} else {\n console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');\n}\n\nvar api_key = document.head.querySelector('meta[name=\"api-key\"]');\nif (api_key) {\n window.axios.defaults.headers.common['x-api-key'] = api_key.content;\n window.PHPVMS_USER_API_KEY = api_key.content;\n} else {\n window.PHPVMS_USER_API_KEY = false;\n console.error('API Key not found!');\n}\n\n// Container for phpVMS specific functions\nwindow.phpvms = {};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvanMvYm9vdHN0cmFwLmpzPzBlNTgiXSwibmFtZXMiOlsid2luZG93IiwiXyIsInJlcXVpcmUiLCJQb3BwZXIiLCJkZWZhdWx0IiwiJCIsImpxdWVyeSIsInNlbGVjdDIiLCJwamF4IiwiYXhpb3MiLCJkZWZhdWx0cyIsImhlYWRlcnMiLCJjb21tb24iLCJ0b2tlbiIsImRvY3VtZW50IiwiaGVhZCIsInF1ZXJ5U2VsZWN0b3IiLCJjb250ZW50IiwiY29uc29s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uICAgIHdpbmRvdy5heGlvcy5kZWZhdWx0cy5oZWFkZXJzLmNvbW1vblsnWC1DU1JGLVRPS0VOJ10gPSB0b2tlbi5jb250ZW50O1xufSBlbHNlIHtcbiAgICBjb25zb2xlLmVycm9yKCdDU1JGIHRva2VuIG5vdCBmb3VuZDogaHR0cHM6Ly9sYXJhdmVsLmNvbS9kb2NzL2NzcmYjY3NyZi14LWNzcmYtdG9rZW4nKTtcbn1cblxuY29uc3QgYXBpX2tleSA9IGRvY3VtZW50LmhlYWQucXVlcnlTZWxlY3RvcignbWV0YVtuYW1lPVwiYXBpLWtleVwiXScpO1xuaWYoYXBpX2tleSkge1xuICAgIHdpbmRvdy5heGlvcy5kZWZhdWx0cy5oZWFkZXJzLmNvbW1vblsneC1hcGkta2V5J10gPSBhcGlfa2V5LmNvbnRlbnQ7XG4gICAgd2luZG93LlBIUFZNU19VU0VSX0FQSV9LRVkgPSBhcGlfa2V5LmNvbnRlbnQ7XG59IGVsc2Uge1xuICAgIHdpbmRvdy5QSFBWTVNfVVNFUl9BUElfS0VZID0gZmFsc2U7XG4gICAgY29uc29sZS5lcnJvcignQVBJIEtleSBub3QgZm91bmQhJyk7XG59XG5cbi8vIENvbnRhaW5lciBmb3IgcGhwVk1TIHNwZWNpZmljIGZ1bmN0aW9uc1xud2luZG93LnBocHZtcyA9IHtcblxufTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyAuL3Jlc291cmNlcy9qcy9ib290c3RyYXAuanMiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./resources/js/bootstrap.js\n");
/***/ }), /***/ }),

View File

@ -230,7 +230,7 @@ eval("// removed by extract-text-webpack-plugin//# sourceURL=[module]\n//# sourc
/***/ "./resources/js/bootstrap.js": /***/ "./resources/js/bootstrap.js":
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
eval("/**\n * Bootstrap any Javascript libraries required\n */\n\nwindow._ = __webpack_require__(\"./node_modules/lodash/lodash.js\");\nwindow.Popper = __webpack_require__(\"./node_modules/popper.js/dist/esm/popper.js\").default;\nwindow.$ = window.jquery = __webpack_require__(\"./node_modules/jquery/dist/jquery.js\");\nwindow.select2 = __webpack_require__(\"./node_modules/select2/dist/js/select2.js\");\nwindow.pjax = __webpack_require__(\"./node_modules/pjax/index.js\");\n\n// Container for phpVMS specific functions\nwindow.phpvms = {};\n\n/**\n * Configure Axios\n */\nwindow.axios = __webpack_require__(\"./node_modules/axios/index.js\");\nwindow.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';\nvar token = document.head.querySelector('meta[name=\"csrf-token\"]');\n\nif (token) {\n window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;\n} else {\n console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvanMvYm9vdHN0cmFwLmpzPzBlNTgiXSwibmFtZXMiOlsid2luZG93IiwiXyIsInJlcXVpcmUiLCJQb3BwZXIiLCJkZWZhdWx0IiwiJCIsImpxdWVyeSIsInNlbGVjdDIiLCJwamF4IiwicGhwdm1zIiwiYXhpb3MiLCJkZWZhdWx0cyIsImhlYWRlcnMiLCJjb21tb24iLCJ0b2tlbiIsImRvY3VtZW50IiwiaGVhZCIsInF1ZXJ5U2VsZWN0b3IiLCJjb250ZW50IiwiY29uc29sZSIsImVycm9yIl0sIm1hcHBpbmdzIjoiQUFBQTs7OztBQUlBQSxPQUFPQyxDQUFQLEdBQVcsbUJBQUFDLENBQVEsaUNBQVIsQ0FBWDtBQUNBRixPQUFPRyxNQUFQLEdBQWdCLG1CQUFBRCxDQUFRLDZDQUFSLEVBQXFCRSxPQUFyQztBQUNBSixPQUFPSyxDQUFQLEdBQVdMLE9BQU9NLE1BQVAsR0FBZ0Isb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JlcXVpcmUoJ3BqYXgnKTtcblxuLy8gQ29udGFpbmVyIGZvciBwaHBWTVMgc3BlY2lmaWMgZnVuY3Rpb25zXG53aW5kb3cucGhwdm1zID0ge1xuXG59O1xuXG4vKipcbiAqIENvbmZpZ3VyZSBBeGlvc1xuICovXG53aW5kb3cuYXhpb3MgPSByZXF1aXJlKCdheGlvcycpO1xud2luZG93LmF4aW9zLmRlZmF1bHRzLmhlYWRlcnMuY29tbW9uWydYLVJlcXVlc3RlZC1XaXRoJ10gPSAnWE1MSHR0cFJlcXVlc3QnO1xubGV0IHRva2VuID0gZG9jdW1lbnQuaGVhZC5xdWVyeVNlbGVjdG9yKCdtZXRhW25hbWU9XCJjc3JmLXRva2VuXCJdJyk7XG5cbmlmICh0b2tlbikge1xuICAgIHdpbmRvdy5heGlvcy5kZWZhdWx0cy5oZWFkZXJzLmNvbW1vblsnWC1DU1JGLVRPS0VOJ10gPSB0b2tlbi5jb250ZW50O1xufSBlbHNlIHtcbiAgICBjb25zb2xlLmVycm9yKCdDU1JGIHRva2VuIG5vdCBmb3VuZDogaHR0cHM6Ly9sYXJhdmVsLmNvbS9kb2NzL2NzcmYjY3NyZi14LWNzcmYtdG9rZW4nKTtcbn1cblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyAuL3Jlc291cmNlcy9qcy9ib290c3RyYXAuanMiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./resources/js/bootstrap.js\n"); eval("/**\n * Bootstrap any Javascript libraries required\n */\n\nwindow._ = __webpack_require__(\"./node_modules/lodash/lodash.js\");\nwindow.Popper = __webpack_require__(\"./node_modules/popper.js/dist/esm/popper.js\").default;\nwindow.$ = window.jquery = __webpack_require__(\"./node_modules/jquery/dist/jquery.js\");\nwindow.select2 = __webpack_require__(\"./node_modules/select2/dist/js/select2.js\");\nwindow.pjax = __webpack_require__(\"./node_modules/pjax/index.js\");\nwindow.axios = __webpack_require__(\"./node_modules/axios/index.js\");\n\n/**\n * Configure Axios with both the csrf token and the API key\n */\nwindow.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';\nvar token = document.head.querySelector('meta[name=\"csrf-token\"]');\n\nif (token) {\n window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;\n} else {\n console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');\n}\n\nvar api_key = document.head.querySelector('meta[name=\"api-key\"]');\nif (api_key) {\n window.axios.defaults.headers.common['x-api-key'] = api_key.content;\n window.PHPVMS_USER_API_KEY = api_key.content;\n} else {\n window.PHPVMS_USER_API_KEY = false;\n console.error('API Key not found!');\n}\n\n// Container for phpVMS specific functions\nwindow.phpvms = {};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9yZXNvdXJjZXMvanMvYm9vdHN0cmFwLmpzPzBlNTgiXSwibmFtZXMiOlsid2luZG93IiwiXyIsInJlcXVpcmUiLCJQb3BwZXIiLCJkZWZhdWx0IiwiJCIsImpxdWVyeSIsInNlbGVjdDIiLCJwamF4IiwiYXhpb3MiLCJkZWZhdWx0cyIsImhlYWRlcnMiLCJjb21tb24iLCJ0b2tlbiIsImRvY3VtZW50IiwiaGVhZCIsInF1ZXJ5U2VsZWN0b3IiLCJjb250ZW50IiwiY29uc29sZSIsImVycm9yIiwiYXBpX2tleSIsIlBIUFZNU19VU0VSX0FQSV9LRVkiLCJwaHB2bXMiXSwibWFwcGluZ3MiOiJBQUFBOzs7O0FBSUFBLE9BQU9DLENBQVAsR0FBVyxtQkFBQUMsQ0FBUSxpQ0FBUixDQUFYO0FBQ0FGLE9BQU9HLE1BQVAsR0FBZ0IsbUJBQUFELENBQVEsNkNBQVIsRUFBcUJFLE9BQXJDO0FBQ0FKLE9BQU9LLENBQVAsR0FBV0wsT0FBT00sTUFBUCxHQUFnQixtQkFBQUosQ0FBUSxzQ0FBUixDQU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YXBpLWtleVwiXScpO1xuaWYoYXBpX2tleSkge1xuICAgIHdpbmRvdy5heGlvcy5kZWZhdWx0cy5oZWFkZXJzLmNvbW1vblsneC1hcGkta2V5J10gPSBhcGlfa2V5LmNvbnRlbnQ7XG4gICAgd2luZG93LlBIUFZNU19VU0VSX0FQSV9LRVkgPSBhcGlfa2V5LmNvbnRlbnQ7XG59IGVsc2Uge1xuICAgIHdpbmRvdy5QSFBWTVNfVVNFUl9BUElfS0VZID0gZmFsc2U7XG4gICAgY29uc29sZS5lcnJvcignQVBJIEtleSBub3QgZm91bmQhJyk7XG59XG5cbi8vIENvbnRhaW5lciBmb3IgcGhwVk1TIHNwZWNpZmljIGZ1bmN0aW9uc1xud2luZG93LnBocHZtcyA9IHtcblxufTtcblxuXG5cbi8vIFdFQlBBQ0sgRk9PVEVSIC8vXG4vLyAuL3Jlc291cmNlcy9qcy9ib290c3RyYXAuanMiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./resources/js/bootstrap.js\n");
/***/ }), /***/ }),

View File

@ -1,6 +1,6 @@
{ {
"/js/admin/app.js": "/js/admin/app.js?id=1cc53441cb171210435d", "/js/admin/app.js": "/js/admin/app.js?id=ef1dc6565068527473d9",
"/js/frontend/app.js": "/js/frontend/app.js?id=650885634c97f0fe2deb", "/js/frontend/app.js": "/js/frontend/app.js?id=aaeb7d6b95393bb168bd",
"/assets/admin/vendor/paper-dashboard.css": "/assets/admin/vendor/paper-dashboard.css?id=3bbf7dd2a80739ab63b9", "/assets/admin/vendor/paper-dashboard.css": "/assets/admin/vendor/paper-dashboard.css?id=3bbf7dd2a80739ab63b9",
"/assets/frontend/css/now-ui-kit.css": "/assets/frontend/css/now-ui-kit.css?id=9923ce002ceafb1d740a", "/assets/frontend/css/now-ui-kit.css": "/assets/frontend/css/now-ui-kit.css?id=9923ce002ceafb1d740a",
"/js/admin/vendor.js": "/js/admin/vendor.js?id=1c5ddb087f24b16da40f", "/js/admin/vendor.js": "/js/admin/vendor.js?id=1c5ddb087f24b16da40f",
@ -13,7 +13,7 @@
"/assets/admin/img/clear.png": "/assets/admin/img/clear.png?id=0e92f4c3efc6988a3c96", "/assets/admin/img/clear.png": "/assets/admin/img/clear.png?id=0e92f4c3efc6988a3c96",
"/assets/admin/img/loading.gif": "/assets/admin/img/loading.gif?id=90a4b76b4f11558691f6", "/assets/admin/img/loading.gif": "/assets/admin/img/loading.gif?id=90a4b76b4f11558691f6",
"/assets/admin/css/vendor.min.css": "/assets/admin/css/vendor.min.css?id=cae3dbc399c60b06b967", "/assets/admin/css/vendor.min.css": "/assets/admin/css/vendor.min.css?id=cae3dbc399c60b06b967",
"/assets/admin/js/vendor.js": "/assets/admin/js/vendor.js?id=f418a91f9cb835e4e2de", "/assets/admin/js/vendor.js": "/assets/admin/js/vendor.js?id=ffb4cf337de6d63b3ec6",
"/assets/admin/css/blue.png": "/assets/admin/css/blue.png?id=753a3c0dec86d3a38d9c", "/assets/admin/css/blue.png": "/assets/admin/css/blue.png?id=753a3c0dec86d3a38d9c",
"/assets/admin/css/blue@2x.png": "/assets/admin/css/blue@2x.png?id=97da23d47b838cbd4bef", "/assets/admin/css/blue@2x.png": "/assets/admin/css/blue@2x.png?id=97da23d47b838cbd4bef",
"/assets/system/js/jquery.js": "/assets/system/js/jquery.js?id=6a07da9fae934baf3f74", "/assets/system/js/jquery.js": "/assets/system/js/jquery.js?id=6a07da9fae934baf3f74",

View File

@ -7,21 +7,32 @@ window.Popper = require('popper.js').default;
window.$ = window.jquery = require('jquery'); window.$ = window.jquery = require('jquery');
window.select2 = require('select2'); window.select2 = require('select2');
window.pjax = require('pjax'); window.pjax = require('pjax');
window.axios = require('axios');
// Container for phpVMS specific functions /**
* Container for phpVMS specific functions
*/
window.phpvms = { window.phpvms = {
}; };
/** /**
* Configure Axios * Configure Axios with both the csrf token and the API key
*/ */
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
let token = document.head.querySelector('meta[name="csrf-token"]'); const token = document.head.querySelector('meta[name="csrf-token"]');
if (token) { if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else { } else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); 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"]');
if(api_key) {
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;
console.error('API Key not found!');
}

2
resources/js/common.js Normal file
View File

@ -0,0 +1,2 @@

View File

@ -7,7 +7,11 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' /> <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' />
<meta name="viewport" content="width=device-width" /> <meta name="viewport" content="width=device-width" />
{{-- Start of required lines block. DON'T REMOVE THESE LINES! They're required or might break things --}}
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="api-key" content="{{ Auth::check() ? Auth::user()->api_key: '' }}">
{{-- End the required lines block --}}
<script src="{{ public_asset('/assets/system/js/jquery.js') }}"></script> <script src="{{ public_asset('/assets/system/js/jquery.js') }}"></script>

View File

@ -5,8 +5,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport'/> <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport'/>
{{-- Don't remove this! It's required --}} {{-- Start of required lines block. DON'T REMOVE THESE LINES! They're required or might break things --}}
<meta name="csrf-token" content="{{ csrf_token() }}"> <meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="api-key" content="{{ Auth::check() ? Auth::user()->api_key: '' }}">
{{-- End the required lines block --}}
<title>@yield('title') - {{ config('app.name') }}</title> <title>@yield('title') - {{ config('app.name') }}</title>
@ -21,9 +23,6 @@
<link href="{{ public_asset('/assets/system/css/vendor.css') }}" rel="stylesheet"/> <link href="{{ public_asset('/assets/system/css/vendor.css') }}" rel="stylesheet"/>
@yield('css') @yield('css')
{{-- This is required to include --}}
@include('system.scripts')
</head> </head>
<body> <body>
<!-- Navbar --> <!-- Navbar -->
@ -53,8 +52,12 @@
<div class="wrapper"> <div class="wrapper">
<div class="clear"></div> <div class="clear"></div>
<div class="container-fluid" style="width: 85%!important;"> <div class="container-fluid" style="width: 85%!important;">
{{-- These should go where you want your content to show up --}}
@include('flash.message') @include('flash.message')
@yield('content') @yield('content')
{{-- End the above block--}}
</div> </div>
<div class="clearfix" style="height: 200px;"></div> <div class="clearfix" style="height: 200px;"></div>
@ -63,7 +66,7 @@
<div class="copyright"> <div class="copyright">
{{-- {{--
Please keep the copyright message somewhere, as-per the LICENSE file Please keep the copyright message somewhere, as-per the LICENSE file
Thanks!! Thanks!!
--}} --}}
powered by <a href="http://www.phpvms.net" target="_blank">phpvms</a> powered by <a href="http://www.phpvms.net" target="_blank">phpvms</a>
</div> </div>
@ -72,20 +75,21 @@
</div> </div>
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script> <script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
{{--<script src="{{ public_asset('/assets/system/js/vendor.js') }}?v={{ time() }}"></script>
<script src="{{ public_asset('/assets/system/js/phpvms.js') }}?v={{ time() }}"></script>--}}
{{-- Start of the required tags block. Don't remove these or things will break!! --}}
<script src="{{ public_asset('/js/frontend/manifest.js') }}"></script> <script src="{{ public_asset('/js/frontend/manifest.js') }}"></script>
<script src="{{ public_asset('/js/frontend/vendor.js') }}"></script> <script src="{{ public_asset('/js/frontend/vendor.js') }}"></script>
<script src="{{ public_asset('/js/frontend/app.js') }}"></script> <script src="{{ public_asset('/js/frontend/app.js') }}"></script>
@yield('scripts')
{{-- End the required tags block --}}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$(".select2").select2(); $(".select2").select2();
}); });
</script> </script>
@yield('scripts')
</body> </body>
</html> </html>

View File

@ -1,28 +1,18 @@
@section('scripts') @section('scripts')
<script> <script>
$(document).ready(() => { const select_id = "select#aircraft_select";
const select_id = "select#aircraft_select"; const destContainer = $('#fares_container');
const destContainer = $('#fares_container');
$(select_id).change((e) => { $(select_id).change((e) => {
const aircraft_id = $(select_id + " option:selected").val();
console.log('aircraft select change: ', aircraft_id);
$.ajax({ const aircraft_id = $(select_id + ' option:selected').val();
url: "{{ url('/pireps/fares') }}?aircraft_id=" + aircraft_id, const url = '{{ url('/pireps/fares') }}?aircraft_id=' + aircraft_id;
type: 'GET', console.log('aircraft select change: ', aircraft_id);
headers: {
'x-api-key': '{{ Auth::user()->api_key }}' axios.get(url).then(response => {
}, console.log('returned new fares', response);
success: (data) => { destContainer.html(response.data);
console.log('returned new fares', data); });
destContainer.html(data); });
}, </script>
error: () => {
destContainer.html('');
}
});
});
});
</script>
@endsection @endsection

View File

@ -2,9 +2,5 @@
DO NOT MODIFY THIS FILE. THINGS WILL BREAK IF YOU DO DO NOT MODIFY THIS FILE. THINGS WILL BREAK IF YOU DO
--}} --}}
<script> <script>
@if (Auth::user())
const PHPVMS_USER_API_KEY = "{{ Auth::user()->api_key }}";
@else
const PHPVMS_USER_API_KEY = false;
@endif
</script> </script>

View File

@ -49,6 +49,7 @@ mix.styles([
mix.scripts([ mix.scripts([
'node_modules/lodash/lodash.js', 'node_modules/lodash/lodash.js',
'node_modules/moment/moment.js', 'node_modules/moment/moment.js',
'node_modules/axios/dist/axios.js',
'node_modules/bootstrap3/dist/js/bootstrap.js', 'node_modules/bootstrap3/dist/js/bootstrap.js',
'node_modules/bootstrap3/js/collapse.js', 'node_modules/bootstrap3/js/collapse.js',
'node_modules/bootstrap3/js/transition.js', 'node_modules/bootstrap3/js/transition.js',