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.

32 lines
975 B

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 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. axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
  10. let token: HTMLMetaElement | null = document.head.querySelector('meta[name="csrf-token"]');
  11. if (token) {
  12. axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
  13. } else {
  14. console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
  15. }
  16. // window.axios.interceptors.request.use((request) => {
  17. // const xsrfToken = Cookie.getByName('XSRF-TOKEN');
  18. //
  19. // if ( ! xsrfToken) {
  20. // window.location.href = '/login';
  21. // }
  22. //
  23. // return request;
  24. // }, (error) => {
  25. // return Promise.reject(error)
  26. // });