fix(web): remove query parameter when clearing search ()

fix: remove query parameter when clearing search
This commit is contained in:
martin 2024-04-15 20:20:32 +02:00 committed by GitHub
parent f959f2de85
commit 7ce1662b05
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 7 deletions
web/src/lib/utils

View file

@ -1,3 +1,12 @@
import { goto } from '$app/navigation';
export const isExternalUrl = (url: string): boolean => {
return new URL(url, window.location.href).origin !== window.location.origin;
};
export const clearQueryParam = async (queryParam: string, url: URL) => {
if (url.searchParams.has(queryParam)) {
url.searchParams.delete(queryParam);
await goto(url);
}
};