mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-10-24 23:06:33 +08:00
Add roadmaps page
This commit is contained in:
+10
-1
@@ -32,11 +32,20 @@ export function setUrlParams(params: Record<string, string>) {
|
||||
}
|
||||
|
||||
const url = new URL(window.location.href);
|
||||
let hasUpdatedUrl = false;
|
||||
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
if (url.searchParams.get(key) === String(value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
url.searchParams.delete(key);
|
||||
url.searchParams.set(key, value);
|
||||
|
||||
hasUpdatedUrl = true;
|
||||
}
|
||||
|
||||
window.history.pushState(null, '', url.toString());
|
||||
if (hasUpdatedUrl) {
|
||||
window.history.pushState(null, '', url.toString());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user