mirror of
https://github.com/wassname/talk.git
synced 2026-06-30 01:07:00 +08:00
13 lines
318 B
JavaScript
13 lines
318 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}`;
|
|
}
|