mirror of
https://github.com/meshtastic/meshtastic.git
synced 2025-03-05 21:00:08 -08:00
remove parameters if no faq open
This commit is contained in:
parent
1a5a0c7ded
commit
0da1b5df48
|
@ -60,8 +60,13 @@ export const FaqAccordion = ({
|
||||||
// Get current url params
|
// Get current url params
|
||||||
const searchParams = new URLSearchParams(window.location.search);
|
const searchParams = new URLSearchParams(window.location.search);
|
||||||
|
|
||||||
// Convert openFaqItems to a comma-separated string and update/add the parameter
|
if (openFaqItems.length > 0) {
|
||||||
searchParams.set(`openFaqItems-${slug}`, openFaqItems.map(String).join(','));
|
// Convert openFaqItems to a comma-separated string and update/add the parameter
|
||||||
|
searchParams.set(`openFaqItems-${slug}`, openFaqItems.map(String).join(','));
|
||||||
|
} else {
|
||||||
|
// If openFaqItems is empty, remove the parameter from the URL
|
||||||
|
searchParams.delete(`openFaqItems-${slug}`);
|
||||||
|
}
|
||||||
|
|
||||||
// Construct the new URL, preserve existing parameters
|
// Construct the new URL, preserve existing parameters
|
||||||
const newUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}?${searchParams.toString()}`;
|
const newUrl = `${window.location.protocol}//${window.location.host}${window.location.pathname}?${searchParams.toString()}`;
|
||||||
|
|
Loading…
Reference in a new issue