projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
17426: Can add plugin middlewares and context menus
[arvados-workbench2.git]
/
src
/
common
/
redirect-to.ts
diff --git
a/src/common/redirect-to.ts
b/src/common/redirect-to.ts
index 7cb0d5805577794fae00148c5fd42f24d360cc8e..77be742f877ce62477a6e3439eb6c020e41821b0 100644
(file)
--- a/
src/common/redirect-to.ts
+++ b/
src/common/redirect-to.ts
@@
-7,23
+7,26
@@
import { Config } from './config';
const REDIRECT_TO_KEY = 'redirectTo';
export const storeRedirects = () => {
const REDIRECT_TO_KEY = 'redirectTo';
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];
+ let redirectUrl;
+ const { location: { href }, localStorage } = window;
- if (sessionStorage) {
- sessionStorage.setItem(REDIRECT_TO_KEY, redirectUrl);
- }
+ if (href.indexOf(REDIRECT_TO_KEY) > -1) {
+ redirectUrl = href.split(`${REDIRECT_TO_KEY}=`)[1];
+ }
+
+ if (localStorage && redirectUrl) {
+ localStorage.setItem(REDIRECT_TO_KEY, redirectUrl);
}
};
export const handleRedirects = (token: string, config: Config) => {
}
};
export const handleRedirects = (token: string, config: Config) => {
- const {
session
Storage } = window;
+ const {
local
Storage } = window;
const { keepWebServiceUrl } = config;
const { keepWebServiceUrl } = config;
- if (sessionStorage && sessionStorage.getItem(REDIRECT_TO_KEY)) {
- const redirectUrl = sessionStorage.getItem(REDIRECT_TO_KEY);
- sessionStorage.removeItem(REDIRECT_TO_KEY);
+ if (localStorage && localStorage.getItem(REDIRECT_TO_KEY)) {
+ const redirectUrl = localStorage.getItem(REDIRECT_TO_KEY);
+ localStorage.removeItem(REDIRECT_TO_KEY);
+
if (redirectUrl) {
const sep = redirectUrl.indexOf("?") > -1 ? "&" : "?";
window.location.href = `${keepWebServiceUrl}${redirectUrl}${sep}api_token=${token}`;
if (redirectUrl) {
const sep = redirectUrl.indexOf("?") > -1 ? "&" : "?";
window.location.href = `${keepWebServiceUrl}${redirectUrl}${sep}api_token=${token}`;