mirror of
				https://github.com/scinote-eln/scinote-web.git
				synced 2025-10-31 00:19:20 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
	
		
			448 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
	
		
			448 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import axios from "axios";
 | |
| 
 | |
| const instance = axios.create({
 | |
|   headers: {
 | |
|     "Content-Type": "application/json",
 | |
|     Accept: "application/json",
 | |
|   },
 | |
| });
 | |
| 
 | |
| instance.interceptors.request.use(
 | |
|   function (config) {
 | |
|     const csrfToken = document.querySelector('[name=csrf-token]').content;
 | |
|     config.headers["X-CSRF-Token"] = csrfToken;
 | |
| 
 | |
|     return config;
 | |
|   },
 | |
|   function (error) {
 | |
|     return Promise.reject(error);
 | |
|   }
 | |
| );
 | |
| 
 | |
| export default instance;
 |