X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/9525ed95bef2a8de63b48a0682c342465d29bae9..ae94f4d8463ff6350329e802cb902c8dad96a710:/src/common/redirect-to.ts?ds=sidebyside diff --git a/src/common/redirect-to.ts b/src/common/redirect-to.ts index 86fac71c..7cb0d580 100644 --- a/src/common/redirect-to.ts +++ b/src/common/redirect-to.ts @@ -10,20 +10,23 @@ export const storeRedirects = () => { if (window.location.href.indexOf(REDIRECT_TO_KEY) > -1) { const { location: { href }, sessionStorage } = window; const redirectUrl = href.split(`${REDIRECT_TO_KEY}=`)[1]; - + if (sessionStorage) { sessionStorage.setItem(REDIRECT_TO_KEY, redirectUrl); } } }; -export const handleRedirects = (config: Config) => { +export const handleRedirects = (token: string, config: Config) => { const { sessionStorage } = window; const { keepWebServiceUrl } = config; if (sessionStorage && sessionStorage.getItem(REDIRECT_TO_KEY)) { const redirectUrl = sessionStorage.getItem(REDIRECT_TO_KEY); sessionStorage.removeItem(REDIRECT_TO_KEY); - window.location.href = `${keepWebServiceUrl}${redirectUrl}`; + if (redirectUrl) { + const sep = redirectUrl.indexOf("?") > -1 ? "&" : "?"; + window.location.href = `${keepWebServiceUrl}${redirectUrl}${sep}api_token=${token}`; + } } -}; \ No newline at end of file +};