This commit is contained in:
2026-02-06 02:55:46 +03:00
parent bbb453826b
commit 9e5e9ddca4
5 changed files with 95 additions and 2 deletions

View File

@ -1,5 +1,7 @@
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3125';
const API_URL = `${API_BASE}/api`;
// В браузере — относительный URL (запросы на тот же хост, Next проксирует /api на бэкенд)
const API_BASE =
typeof window !== 'undefined' ? '' : (process.env.API_URL || 'http://localhost:3125');
const API_URL = API_BASE ? `${API_BASE.replace(/\/$/, '')}/api` : '/api';
const STORAGE_KEY = 'coursecraft_api_token';