mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 02:00:10 +02:00
12 lines
287 B
JavaScript
12 lines
287 B
JavaScript
export function buildUrlWithDetachRole(mode) {
|
|
const url = new URL(window.location)
|
|
let cleanPathname = url.pathname
|
|
.replace(/\/(detached|detacher)\/?$/, '')
|
|
.replace(/\/$/, '')
|
|
if (mode) {
|
|
cleanPathname += `/${mode}`
|
|
}
|
|
url.pathname = cleanPathname
|
|
return url
|
|
}
|