fix: devUser-Parameter an alle API-Calls weiterleiten
Build & Deploy Tippspiel / build (push) Successful in 30s

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) <noreply@anthropic.com>
This commit is contained in:
Ronny
2026-04-11 17:03:11 +02:00
parent e86ae62309
commit d02e81851e
+8 -1
View File
@@ -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<T>(path: string, options?: RequestInit): Promise<T> {
const res = await fetch(`${BASE}${path}`, {
const res = await fetch(`${BASE}${withDevUser(path)}`, {
...options,
headers: {
'Content-Type': 'application/json',