| -+ | 1 | // Polyfills | ||
| 2 | require('core-js/fn/symbol/iterator'); | |||
| 3 | require('core-js/es6/symbol'); | |||
| 4 | require('core-js/es7/object'); | |||
| 5 | require('core-js/es7/array'); | |||
| 6 | ||||
| 1 | /** | = | 7 | /** |
| 2 | * We'll load the axios HTTP library which allows us to easily issue requests | 8 | * We'll load the axios HTTP library which allows us to easily issue requests | |
| 3 | * to our Laravel back-end. This library automatically handles sending the | 9 | * to our Laravel back-end. This library automatically handles sending the | |
| 4 | * CSRF token as a header based on the value of the "XSRF" token cookie. | 10 | * CSRF token as a header based on the value of the "XSRF" token cookie. | |
| 5 | */ | 11 | */ | |
| 6 | 12 | |||
| 7 | window.axios = require('axios'); | 13 | window.axios = require('axios'); | |
| 8 | 14 | |||
| 9 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; | 15 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; | |
| 10 | 16 | |||
| 11 | /** | 17 | /** | |
| 12 | * Next we will register the CSRF Token as a common header with Axios so that | 18 | * Next we will register the CSRF Token as a common header with Axios so that | |
| 13 | * all outgoing HTTP requests automatically have it attached. This is just | 19 | * all outgoing HTTP requests automatically have it attached. This is just | |
| 14 | * a simple convenience so we don't have to attach every token manually. | 20 | * a simple convenience so we don't have to attach every token manually. | |
| 15 | */ | 21 | */ | |
| 16 | 22 | |||
| 17 | let token = document.head.querySelector('meta[name="csrf-token"]'); | 23 | let token = document.head.querySelector('meta[name="csrf-token"]'); | |
| 18 | 24 | |||
| 19 | if (token) { | 25 | if (token) { | |
| 20 | window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; | 26 | window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; | |
| 21 | } else { | 27 | } else { | |
| 22 | console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); | 28 | console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); | |
| 23 | } | 29 | } | |
| 24 | 30 | |||
| 25 | /** | 31 | /** | |
| 26 | * Echo exposes an expressive API for subscribing to channels and listening | 32 | * Echo exposes an expressive API for subscribing to channels and listening | |
| 27 | * for events that are broadcast by Laravel. Echo and event broadcasting | 33 | * for events that are broadcast by Laravel. Echo and event broadcasting | |
| 28 | * allows your team to easily build robust real-time web applications. | 34 | * allows your team to easily build robust real-time web applications. | |
| 29 | */ | 35 | */ | |
| 30 | 36 | |||
| 31 | // import Echo from 'laravel-echo' | 37 | // import Echo from 'laravel-echo' | |
| 32 | 38 | |||
| 33 | // window.Pusher = require('pusher-js'); | 39 | // window.Pusher = require('pusher-js'); | |
| 34 | 40 | |||
| 35 | // window.Echo = new Echo({ | 41 | // window.Echo = new Echo({ | |
| 36 | // broadcaster: 'pusher', | 42 | // broadcaster: 'pusher', | |
| 37 | // key: process.env.MIX_PUSHER_APP_KEY, | 43 | // key: process.env.MIX_PUSHER_APP_KEY, | |
| 38 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER, | 44 | // cluster: process.env.MIX_PUSHER_APP_CLUSTER, | |
| 39 | // encrypted: true | 45 | // encrypted: true | |
| 40 | // }); | 46 | // }); | |
| 41 | 47 | |||
| 42 | /** | 48 | /** | |
| 43 | * Load Vue.js app | 49 | * Load Vue.js app | |
| 44 | */ | 50 | */ | |
| 45 | 51 | |||
| 46 | require('./main.js'); | 52 | require('./main.js'); |