fix(api): use API_INTERNAL_URL in tags and persons proxy routes
Some checks failed
CI / Unit & Component Tests (push) Has been cancelled
CI / Backend Unit Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Unit & Component Tests (pull_request) Has been cancelled
CI / Backend Unit Tests (pull_request) Has been cancelled
CI / E2E Tests (pull_request) Has been cancelled

Both SvelteKit API proxy routes were hardcoding http://localhost:8080,
breaking typeahead search in Docker environments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-19 12:58:21 +01:00
parent a52b8a0694
commit 5044f99aac
2 changed files with 4 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { env } from 'process';
export const GET: RequestHandler = async ({ url, fetch }) => {
// 1. Suchparameter aus der URL des Browsers holen
@@ -8,7 +9,7 @@ export const GET: RequestHandler = async ({ url, fetch }) => {
try {
// 3. Anfrage an das Java-Backend weiterleiten (Server-to-Server)
// Wir nutzen hier den internen Docker-Hostnamen oder localhost, je nach Netzwerk
const backendUrl = `http://localhost:8080/api/persons?q=${encodeURIComponent(q)}`;
const backendUrl = `${env.API_INTERNAL_URL || 'http://localhost:8080'}/api/persons?q=${encodeURIComponent(q)}`;
const response = await fetch(backendUrl, {
method: 'GET',

View File

@@ -1,5 +1,6 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { env } from 'process';
export const GET: RequestHandler = async ({ url, fetch }) => {
// 1. Suchparameter aus der URL des Browsers holen
@@ -8,7 +9,7 @@ export const GET: RequestHandler = async ({ url, fetch }) => {
try {
// 3. Anfrage an das Java-Backend weiterleiten (Server-to-Server)
// Wir nutzen hier den internen Docker-Hostnamen oder localhost, je nach Netzwerk
const backendUrl = `http://localhost:8080/api/tags?q=${encodeURIComponent(q)}`;
const backendUrl = `${env.API_INTERNAL_URL || 'http://localhost:8080'}/api/tags?q=${encodeURIComponent(q)}`;
const response = await fetch(backendUrl, {
method: 'GET',