From 7bbbe01a03432778f0ff166eeb5f9114b551ca6f Mon Sep 17 00:00:00 2001 From: Ronny Date: Sat, 11 Apr 2026 17:03:11 +0200 Subject: [PATCH] fix: devUser-Parameter an alle API-Calls weiterleiten MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Im Dev-Modus wurde der devUser Query-Parameter aus der Browser-URL nicht an die Backend-API-Calls weitergegeben. Dadurch liefen alle Requests immer als devUser=1 (Ronny), unabhängig vom gewählten User. Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/api/client.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/api/client.ts b/frontend/src/api/client.ts index 96104a9..ccbd951 100644 --- a/frontend/src/api/client.ts +++ b/frontend/src/api/client.ts @@ -1,7 +1,14 @@ const BASE = '/api'; +function withDevUser(path: string): string { + const devUser = new URLSearchParams(window.location.search).get('devUser'); + if (!devUser) return path; + const sep = path.includes('?') ? '&' : '?'; + return `${path}${sep}devUser=${devUser}`; +} + async function request(path: string, options?: RequestInit): Promise { - const res = await fetch(`${BASE}${path}`, { + const res = await fetch(`${BASE}${withDevUser(path)}`, { ...options, headers: { 'Content-Type': 'application/json',