2021-07-22 08:56:42 +03:00
|
|
|
export function apiPath(site, path = '') {
|
2021-07-21 16:50:26 +03:00
|
|
|
return `/api/stats/${encodeURIComponent(site.domain)}${path}`
|
|
|
|
}
|
|
|
|
|
2021-11-26 12:41:41 +03:00
|
|
|
export function siteBasePath(site, path = '') {
|
|
|
|
return `/${encodeURIComponent(site.domain)}${path}`
|
|
|
|
}
|
|
|
|
|
2021-07-22 08:56:42 +03:00
|
|
|
export function sitePath(site, path = '') {
|
2021-11-29 13:30:19 +03:00
|
|
|
return siteBasePath(site, path) + window.location.search
|
2021-07-21 16:50:26 +03:00
|
|
|
}
|
2021-09-21 11:44:51 +03:00
|
|
|
|
|
|
|
export function setQuery(key, value) {
|
|
|
|
const query = new URLSearchParams(window.location.search)
|
|
|
|
query.set(key, value)
|
2021-09-27 17:16:25 +03:00
|
|
|
return `${window.location.pathname}?${query.toString()}`
|
2021-09-21 11:44:51 +03:00
|
|
|
}
|
2021-09-27 17:07:29 +03:00
|
|
|
|
|
|
|
export function externalLinkForPage(domain, page) {
|
|
|
|
const domainURL = new URL(`https://${domain}`)
|
|
|
|
return `https://${domainURL.host}${page}`
|
|
|
|
}
|