Repo for the search and displace core module including the interface to select files and search and displace operations to run on them.
https://searchanddisplace.com
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1008 B
35 lines
1008 B
import Cookie from './SearchDisplace/Cookie';
|
|
|
|
// window._ = require('lodash');
|
|
|
|
/**
|
|
* We'll load the axios HTTP library which allows us to easily issue requests
|
|
* to our Laravel back-end. This library automatically handles sending the
|
|
* CSRF token as a header based on the value of the "XSRF" token cookie.
|
|
*/
|
|
|
|
import axios from "axios";
|
|
|
|
(window as any).axios = axios;
|
|
|
|
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
|
|
|
|
let token: HTMLMetaElement | null = document.head.querySelector('meta[name="csrf-token"]');
|
|
|
|
if (token) {
|
|
axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
|
|
} else {
|
|
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
|
|
}
|
|
|
|
// window.axios.interceptors.request.use((request) => {
|
|
// const xsrfToken = Cookie.getByName('XSRF-TOKEN');
|
|
//
|
|
// if ( ! xsrfToken) {
|
|
// window.location.href = '/login';
|
|
// }
|
|
//
|
|
// return request;
|
|
// }, (error) => {
|
|
// return Promise.reject(error)
|
|
// });
|