feature (Share): workable version for sharing

This commit is contained in:
Mickael KERJEAN
2018-10-04 17:03:17 +10:00
parent 2c086c24b7
commit 8f62551787
43 changed files with 1412 additions and 348 deletions

View File

@ -35,3 +35,19 @@ export function absoluteToRelative(from, to){
}
return r;
}
export function currentShare(){
return new window.URL(location.href).searchParams.get("share") || ""
}
export function appendShareToUrl(link) {
let url = new window.URL(location.href);
let share = url.searchParams.get("share");
if(share){
url = new window.URL(location.origin + link)
url.searchParams.set("share", share)
return url.pathname + url.search
}
return link;
}