mirror of
https://github.com/wassname/talk.git
synced 2026-09-11 12:51:33 +08:00
Improved Comment URL Handling (#1860)
* feat: replaces PR 1819 - fixes #1851 * fix: set query using new syntax * review: fixes for missed framework changes * fix: linting
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import parse from 'url-parse';
|
||||
|
||||
export function buildUrl(
|
||||
{ protocol, hostname, port, pathname, search, hash } = window.location
|
||||
) {
|
||||
@@ -10,3 +12,10 @@ export function buildUrl(
|
||||
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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user