Fix hardcoded localhost:8000 URLs
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
- Add backend/utils.py for URL management - Update serializers to use normalize_file_url() - Update views to use URL utils from env vars - Fix frontend components to use NEXT_PUBLIC_API_URL - Add new env vars: DJANGO_BACKEND_URL, DJANGO_MEDIA_BASE_URL - Replace all hardcoded localhost:8000 with configurable URLs
This commit is contained in:
@@ -84,7 +84,7 @@ export default function UserPage({
|
||||
|
||||
// Определяем API URL в зависимости от окружения
|
||||
const API = typeof window !== 'undefined'
|
||||
? (process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000') // клиент
|
||||
? (process.env.NEXT_PUBLIC_API_URL || 'https://links.shareon.kr') // клиент
|
||||
: 'http://web:8000' // сервер в Docker
|
||||
|
||||
console.log('Loading data for user:', usernameValue)
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function RegisterPage() {
|
||||
}
|
||||
|
||||
try {
|
||||
const API = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
|
||||
const API = process.env.NEXT_PUBLIC_API_URL || 'https://links.shareon.kr'
|
||||
const response = await fetch(`${API}/api/auth/register/`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
||||
@@ -55,7 +55,7 @@ export function CustomizationPanel({ isOpen, onClose, onSettingsUpdate }: Custom
|
||||
const loadSettings = async () => {
|
||||
try {
|
||||
const token = localStorage.getItem('token')
|
||||
const API = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
|
||||
const API = process.env.NEXT_PUBLIC_API_URL || 'https://links.shareon.kr'
|
||||
const response = await fetch(`${API}/api/customization/settings/`, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`
|
||||
@@ -75,7 +75,7 @@ export function CustomizationPanel({ isOpen, onClose, onSettingsUpdate }: Custom
|
||||
setLoading(true)
|
||||
try {
|
||||
const token = localStorage.getItem('token')
|
||||
const API = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
|
||||
const API = process.env.NEXT_PUBLIC_API_URL || 'https://links.shareon.kr'
|
||||
|
||||
// Если есть новый файл фоновой картинки, отправляем через FormData
|
||||
if (backgroundImageFile) {
|
||||
|
||||
@@ -86,7 +86,7 @@ export function LayoutWrapper({ children }: { children: ReactNode }) {
|
||||
user.avatar && user.avatar.startsWith('http')
|
||||
? user.avatar
|
||||
: user.avatar
|
||||
? `http://localhost:8000${user.avatar}`
|
||||
? `${process.env.NEXT_PUBLIC_API_URL || 'https://links.shareon.kr'}${user.avatar}`
|
||||
: '/assets/img/avatar-dhg.png'
|
||||
}
|
||||
alt="Avatar"
|
||||
|
||||
Reference in New Issue
Block a user