mirror of
https://github.com/overleaf/overleaf.git
synced 2024-09-16 02:52:31 -04:00
12 lines
288 B
JavaScript
12 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
|
||
|
}
|