ваше сообщение коммита

This commit is contained in:
2025-04-21 10:40:57 +03:00
parent 483a1ef854
commit 5a8e62924c
20 changed files with 637 additions and 84 deletions

View File

@@ -1,8 +1,18 @@
import axios from 'axios';
// Определяем baseURL в зависимости от окружения
const getBaseUrl = () => {
// В браузере используем localhost
if (typeof window !== 'undefined' && window.location.hostname === 'localhost') {
return 'http://localhost:8000';
}
// В других случаях используем переменную окружения
return import.meta.env.VITE_API_URL || '';
};
// Создаем экземпляр axios с базовым URL
const api = axios.create({
baseURL: import.meta.env.VITE_API_URL || '',
baseURL: getBaseUrl(),
withCredentials: true,
headers: {
'Content-Type': 'application/json'