File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/ng-generate/components/table/generators/services/storage/files Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -20,15 +20,19 @@ export class JSSdkLocal<%= classify(name) %>Service implements BrowserStorage {
2020 readonly KEY_PREFIX = 'JSSDK_';
2121
2222 getItem<T = any>(key: string): T {
23- const item = localStorage.getItem(`${ this.KEY_PREFIX}${ key}` );
23+ const item = localStorage.getItem(this.buildKey( key) );
2424 return item ? JSON.parse(item) : undefined;
2525 }
2626
2727 removeItem(key: string): void {
28- localStorage.removeItem(key);
28+ localStorage.removeItem(this.buildKey( key) );
2929 }
3030
3131 setItem<T = any>(key: string, item: T): void {
32- localStorage.setItem(`${this.KEY_PREFIX}${key}`, JSON.stringify(item));
32+ localStorage.setItem(this.buildKey(key), JSON.stringify(item));
33+ }
34+
35+ private buildKey(key: string): string {
36+ return `${this.KEY_PREFIX}${key}`;
3337 }
3438}
You can’t perform that action at this time.
0 commit comments