feat(frontend): initialize Vue 3 + Vite project structure

This commit is contained in:
2025-06-17 07:54:41 +03:00
parent d7d61f9de3
commit df460f57ab
18 changed files with 2175 additions and 0 deletions

26
src/api/axios.ts Normal file
View File

@@ -0,0 +1,26 @@
import axios from "axios";
const apiClient = axios.create({
// Vite предоставляет переменную import.meta.env.VITE_API_URL
// В режиме разработки это будет прокси, в продакшене - реальный URL
baseURL: import.meta.env.VITE_API_URL || "/api",
headers: {
"Content-Type": "application/json",
},
});
// Мы можем добавить interceptor для автоматического добавления JWT
apiClient.interceptors.request.use(
(config) => {
const token = localStorage.getItem("authToken");
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
},
(error) => {
return Promise.reject(error);
},
);
export default apiClient;