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

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. import Cookie from './SearchDisplace/Cookie';
  2. // window._ = require('lodash');
  3. /**
  4. * We'll load the axios HTTP library which allows us to easily issue requests
  5. * to our Laravel back-end. This library automatically handles sending the
  6. * CSRF token as a header based on the value of the "XSRF" token cookie.
  7. */
  8. import axios from "axios";
  9. (window as any).axios = axios;
  10. axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  11. let token: HTMLMetaElement | null = document.head.querySelector('meta[name="csrf-token"]');
  12. if (token) {
  13. axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  14. } else {
  15. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  16. }
  17. // window.axios.interceptors.request.use((request) => {
  18. // const xsrfToken = Cookie.getByName('XSRF-TOKEN');
  19. //
  20. // if ( ! xsrfToken) {
  21. // window.location.href = '/login';
  22. // }
  23. //
  24. // return request;
  25. // }, (error) => {
  26. // return Promise.reject(error)
  27. // });