vault/ui/app/lib/memory-storage.ts
Jordan Reimer bbcd0e0465
[UI] API Service (#29965)
* adds api service

* adds missing copyright headers

* Update ui/app/services/api.ts

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>

* removes response cache and comments from api service

* removes hide warnings condition from showWarnings middleware in api service

* splits out setHeaders test

---------

Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
2025-03-20 16:28:02 -06:00

26 lines
429 B
TypeScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
const cache: { [key: string]: string } = {};
export default {
getItem(key: string) {
const item = cache[key];
return item && JSON.parse(item);
},
setItem(key: string, val: unknown) {
cache[key] = JSON.stringify(val);
},
removeItem(key: string) {
delete cache[key];
},
keys() {
return Object.keys(cache);
},
};