From be9525dbf2fb6bfbb5898a2ba244e7e3f4bd34da Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Wed, 12 Mar 2025 14:37:50 +0530 Subject: [PATCH] fix: empty query string with trailing ? Fixes #1376 --- frontend/src/pages/Batches.vue | 7 ++++++- frontend/src/pages/Courses.vue | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/Batches.vue b/frontend/src/pages/Batches.vue index 788f1f4f..4a3a05b9 100644 --- a/frontend/src/pages/Batches.vue +++ b/frontend/src/pages/Batches.vue @@ -251,7 +251,12 @@ const setQueryParams = () => { } }) - history.replaceState({}, '', `${location.pathname}?${queries.toString()}`) + let queryString = ''; + if (queries.toString()) { + queryString = `?${queries.toString()}` + } + + history.replaceState({}, '', `${location.pathname}${queryString}`) } const updateCategories = (data) => { diff --git a/frontend/src/pages/Courses.vue b/frontend/src/pages/Courses.vue index 634eeb6e..51cf56aa 100644 --- a/frontend/src/pages/Courses.vue +++ b/frontend/src/pages/Courses.vue @@ -256,7 +256,13 @@ const setQueryParams = () => { } }) - history.replaceState({}, '', `${location.pathname}?${queries.toString()}`) + + let queryString = ''; + if (queries.toString()) { + queryString = `?${queries.toString()}` + } + + history.replaceState({}, '', `${location.pathname}${queryString}`) } const updateCategories = (data) => {