mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-18 12:37:02 +02:00
* work in progress: got the expired banner set with license check * wip: got the logic for both banners, need to test and write tests * add notes * prep for test writing * test coverage * add changelog * clean up * clarify dismissTypes and conditionals * updates * update comment * update comment * address pr comments * update test * small naming change * small naming changes * clean localStorage * comment clean up * another comment clean up * remove meep * add test coverage for new method in localStorage
29 lines
620 B
JavaScript
29 lines
620 B
JavaScript
export default {
|
|
getItem(key) {
|
|
var item = window.localStorage.getItem(key);
|
|
return item && JSON.parse(item);
|
|
},
|
|
|
|
setItem(key, val) {
|
|
window.localStorage.setItem(key, JSON.stringify(val));
|
|
},
|
|
|
|
removeItem(key) {
|
|
return window.localStorage.removeItem(key);
|
|
},
|
|
|
|
keys() {
|
|
return Object.keys(window.localStorage);
|
|
},
|
|
|
|
cleanUpStorage(string, keyToKeep) {
|
|
if (!string) return;
|
|
const relevantKeys = this.keys().filter((str) => str.startsWith(string));
|
|
relevantKeys?.forEach((key) => {
|
|
if (key !== keyToKeep) {
|
|
localStorage.removeItem(key);
|
|
}
|
|
});
|
|
},
|
|
};
|