mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-11 05:24:53 +00:00
11 lines
288 B
JavaScript
11 lines
288 B
JavaScript
export function buildUrlWithDetachRole(mode) {
|
|
const url = new URL(window.location)
|
|
const cleanPathname = url.pathname
|
|
.replace(/\/(detached|detacher)\/?$/, '')
|
|
.replace(/\/$/, '')
|
|
url.pathname = cleanPathname
|
|
if (mode) {
|
|
url.pathname += `/${mode}`
|
|
}
|
|
return url
|
|
}
|