aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/core-utils
diff options
context:
space:
mode:
Diffstat (limited to 'shared/core-utils')
-rw-r--r--shared/core-utils/common/url.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/shared/core-utils/common/url.ts b/shared/core-utils/common/url.ts
index d1c399f7b..33fc5ee3a 100644
--- a/shared/core-utils/common/url.ts
+++ b/shared/core-utils/common/url.ts
@@ -11,6 +11,14 @@ function addQueryParams (url: string, params: { [ id: string ]: string }) {
11 return objUrl.toString() 11 return objUrl.toString()
12} 12}
13 13
14function removeQueryParams (url: string) {
15 const objUrl = new URL(url)
16
17 objUrl.searchParams.forEach((_v, k) => objUrl.searchParams.delete(k))
18
19 return objUrl.toString()
20}
21
14function buildPlaylistLink (playlist: Pick<VideoPlaylist, 'shortUUID'>, base?: string) { 22function buildPlaylistLink (playlist: Pick<VideoPlaylist, 'shortUUID'>, base?: string) {
15 return (base ?? window.location.origin) + buildPlaylistWatchPath(playlist) 23 return (base ?? window.location.origin) + buildPlaylistWatchPath(playlist)
16} 24}
@@ -114,6 +122,7 @@ function decoratePlaylistLink (options: {
114 122
115export { 123export {
116 addQueryParams, 124 addQueryParams,
125 removeQueryParams,
117 126
118 buildPlaylistLink, 127 buildPlaylistLink,
119 buildVideoLink, 128 buildVideoLink,