Revert UI: replace localStorage with sessionStorage (#15769)
* Revert UI: replace localStorage with sessionStorage * Add changelog
This commit is contained in:
parent
c15f524993
commit
c67f4927b2
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
ui: Revert using localStorage in favor of sessionStorage
|
||||||
|
```
|
|
@ -1,18 +1,18 @@
|
||||||
export default {
|
export default {
|
||||||
getItem(key) {
|
getItem(key) {
|
||||||
var item = window.sessionStorage.getItem(key);
|
var item = window.localStorage.getItem(key);
|
||||||
return item && JSON.parse(item);
|
return item && JSON.parse(item);
|
||||||
},
|
},
|
||||||
|
|
||||||
setItem(key, val) {
|
setItem(key, val) {
|
||||||
window.sessionStorage.setItem(key, JSON.stringify(val));
|
window.localStorage.setItem(key, JSON.stringify(val));
|
||||||
},
|
},
|
||||||
|
|
||||||
removeItem(key) {
|
removeItem(key) {
|
||||||
return window.sessionStorage.removeItem(key);
|
return window.localStorage.removeItem(key);
|
||||||
},
|
},
|
||||||
|
|
||||||
keys() {
|
keys() {
|
||||||
return Object.keys(window.sessionStorage);
|
return Object.keys(window.localStorage);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@ export default function (type) {
|
||||||
}
|
}
|
||||||
let storage;
|
let storage;
|
||||||
try {
|
try {
|
||||||
localStorageWrapper.getItem('test');
|
window.localStorage.getItem('test');
|
||||||
storage = localStorageWrapper;
|
storage = localStorageWrapper;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
storage = memoryStorage;
|
storage = memoryStorage;
|
||||||
|
|
|
@ -173,7 +173,7 @@ module('Acceptance | Enterprise | control groups', function (hooks) {
|
||||||
await authPage.login(context.userToken);
|
await authPage.login(context.userToken);
|
||||||
await settled();
|
await settled();
|
||||||
if (shouldStoreToken) {
|
if (shouldStoreToken) {
|
||||||
sessionStorage.setItem(
|
localStorage.setItem(
|
||||||
storageKey(accessor, 'kv/foo'),
|
storageKey(accessor, 'kv/foo'),
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
accessor,
|
accessor,
|
||||||
|
|
|
@ -47,7 +47,7 @@ module('Acceptance | redirect_to query param functionality', function (hooks) {
|
||||||
// normally we'd use the auth.logout helper to visit the route and reset the app, but in this case that
|
// normally we'd use the auth.logout helper to visit the route and reset the app, but in this case that
|
||||||
// also routes us to the auth page, and then all of the transitions from the auth page get redirected back
|
// also routes us to the auth page, and then all of the transitions from the auth page get redirected back
|
||||||
// to the auth page resulting in no redirect_to query param being set
|
// to the auth page resulting in no redirect_to query param being set
|
||||||
sessionStorage.clear();
|
localStorage.clear();
|
||||||
});
|
});
|
||||||
test('redirect to a route after authentication', async function (assert) {
|
test('redirect to a route after authentication', async function (assert) {
|
||||||
let url = '/vault/secrets/secret/create';
|
let url = '/vault/secrets/secret/create';
|
||||||
|
|
Loading…
Reference in New Issue