formatting

This commit is contained in:
Виталий Лавшонок
2025-11-04 15:04:59 +03:00
parent 3cd8e14288
commit 4972836164
60 changed files with 3604 additions and 2916 deletions

View File

@@ -1,24 +1,24 @@
import axios from "axios";
import axios from 'axios';
const instance = axios.create({
baseURL: import.meta.env.VITE_API_URL,
headers: {
'Content-Type': 'application/json'
},
baseURL: import.meta.env.VITE_API_URL,
headers: {
'Content-Type': 'application/json',
},
});
// Request interceptor: автоматически подставляет JWT, если есть
instance.interceptors.request.use(
(config) => {
const token = localStorage.getItem("jwt"); // или можно брать из Redux через store.getState()
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
},
(error) => {
return Promise.reject(error);
}
(config) => {
const token = localStorage.getItem('jwt'); // или можно брать из Redux через store.getState()
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
},
(error) => {
return Promise.reject(error);
},
);
export default instance;