HomeAccounting
55 строк · 1.7 Кб
1
2window._ = require('lodash');3window.Popper = require('popper.js').default;4
5/**
6* We'll load jQuery and the Bootstrap jQuery plugin which provides support
7* for JavaScript based Bootstrap features such as modals and tabs. This
8* code may be modified to fit the specific needs of your application.
9*/
10
11try {12window.$ = window.jQuery = require('jquery');13
14require('bootstrap');15} catch (e) {}16
17/**
18* We'll load the axios HTTP library which allows us to easily issue requests
19* to our Laravel back-end. This library automatically handles sending the
20* CSRF token as a header based on the value of the "XSRF" token cookie.
21*/
22
23window.axios = require('axios');24
25window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';26
27/**
28* Next we will register the CSRF Token as a common header with Axios so that
29* all outgoing HTTP requests automatically have it attached. This is just
30* a simple convenience so we don't have to attach every token manually.
31*/
32
33let token = document.head.querySelector('meta[name="csrf-token"]');34
35if (token) {36window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;37} else {38console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');39}
40
41/**
42* Echo exposes an expressive API for subscribing to channels and listening
43* for events that are broadcast by Laravel. Echo and event broadcasting
44* allows your team to easily build robust real-time web applications.
45*/
46
47// import Echo from 'laravel-echo'
48
49// window.Pusher = require('pusher-js');
50
51// window.Echo = new Echo({
52// broadcaster: 'pusher',
53// key: process.env.MIX_PUSHER_APP_KEY,
54// cluster: process.env.MIX_PUSHER_APP_CLUSTER,
55// encrypted: true
56// });
57