1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-19 23:53:24 +02:00

Fix failing build

This commit is contained in:
Kamran Ahmed
2023-09-30 14:28:16 +01:00
parent 5d57d5baaf
commit 6d1edb76c7

View File

@@ -1,4 +1,8 @@
export function getUrlParams() {
if (typeof window === 'undefined') {
return {};
}
const params = new URLSearchParams(window.location.search);
const paramsObj: Record<string, any> = {};
for (const [key, value] of params.entries()) {
@@ -9,6 +13,10 @@ export function getUrlParams() {
}
export function deleteUrlParam(key: string) {
if (typeof window === 'undefined') {
return;
}
const url = new URL(window.location.href);
if (!url.searchParams.has(key)) {
return;
@@ -19,6 +27,10 @@ export function deleteUrlParam(key: string) {
}
export function setUrlParams(params: Record<string, string>) {
if (typeof window === 'undefined') {
return;
}
const url = new URL(window.location.href);
for (const [key, value] of Object.entries(params)) {