mirror of
https://github.com/wassname/talk.git
synced 2026-07-03 20:57:49 +08:00
c19d4a433a
* feat: replaces PR 1819 - fixes #1851 * fix: set query using new syntax * review: fixes for missed framework changes * fix: linting
22 lines
520 B
JavaScript
22 lines
520 B
JavaScript
import parse from 'url-parse';
|
|
|
|
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}`;
|
|
}
|
|
|
|
export function buildCommentURL(assetURL, commentID) {
|
|
const u = parse(assetURL, true);
|
|
u.query.commentId = commentID;
|
|
u.set('query', u.query);
|
|
return u.href;
|
|
}
|