pub fn set_url_parameter_and_refresh(key: &str, value: &str) -> Result<(), wasm_bindgen::JsValue> {
let Some(window) = web_sys::window() else {
return Err("Failed to get window".into());
};
let location = window.location();
let url = web_sys::Url::new(&location.href()?)?;
url.search_params().set(key, value);
location.assign(&url.href())
}