From c23f44952052154e8425df291caf5da555fe3fc6 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Wed, 5 Aug 2026 16:02:27 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(frontend)=20stop=20passing=20usern?= =?UTF-8?q?ame=20as=20a=20query=20param=20when=20undefined?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Skip adding the username query parameter when its value is undefined, so the request URL no longer ends up with an `?username=undefined` (or similar) that the backend has to handle. --- src/frontend/src/features/rooms/api/fetchRoom.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/frontend/src/features/rooms/api/fetchRoom.ts b/src/frontend/src/features/rooms/api/fetchRoom.ts index 4c014d27..bdbd1085 100644 --- a/src/frontend/src/features/rooms/api/fetchRoom.ts +++ b/src/frontend/src/features/rooms/api/fetchRoom.ts @@ -3,12 +3,12 @@ import { fetchApi } from '@/api/fetchApi' export const fetchRoom = ({ roomId, - username = '', + username, }: { roomId: string username?: string }) => { - return fetchApi( - `/rooms/${roomId}?username=${encodeURIComponent(username)}` - ) + const query = username ? `?username=${encodeURIComponent(username)}` : '' + + return fetchApi(`/rooms/${roomId}${query}`) }