X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ee347878e1ad3b6f82787ac27b6d3b6510401ecd..ebbe5fdc661b279c5166dae75381442c2e37f1f1:/src/services/auth-service/auth-service.ts diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts index 52bfa29eca..b530e4cd3e 100644 --- a/src/services/auth-service/auth-service.ts +++ b/src/services/auth-service/auth-service.ts @@ -120,9 +120,13 @@ export class AuthService { window.location.assign(`https://${homeClusterHost}/login?${(uuidPrefix !== homeCluster && homeCluster !== loginCluster) ? "remote=" + uuidPrefix + "&" : ""}return_to=${currentUrl}`); } - public logout(expireToken: string) { - const currentUrl = `${window.location.protocol}//${window.location.host}`; - window.location.assign(`${this.baseUrl || ""}/logout?api_token=${expireToken}&return_to=${currentUrl}`); + public logout(expireToken: string, preservePath: boolean) { + const fullUrl = new URL(window.location.href); + const wbBase = `${fullUrl.protocol}//${fullUrl.host}`; + const wbPath = fullUrl.pathname + fullUrl.search; + const returnTo = `${wbBase}${preservePath ? wbPath : ''}` + + window.location.assign(`${this.baseUrl || ""}/logout?api_token=${expireToken}&return_to=${returnTo}`); } public getUserDetails = (showErrors?: boolean): Promise => {