mirror of
https://github.com/wassname/talk.git
synced 2026-06-28 20:57:28 +08:00
9 lines
304 B
JavaScript
9 lines
304 B
JavaScript
export function buildUrl({protocol, hostname, port, pathname, search, hash} = window.location) {
|
|
if (search && search[0] !== '?') {
|
|
search = `?${search}`;
|
|
} else if (search === '?') {
|
|
search = '';
|
|
}
|
|
return `${protocol}//${hostname}${port ? `:${port}` : ''}${pathname}${search}${hash}`;
|
|
}
|