Files
kupshop/web/common/webpack/assets/js-shop/SessionStorage.ts
2025-08-02 16:30:27 +02:00

18 lines
457 B
TypeScript

export class SessionStorage {
public static get = (key: string): any | null => {
const storageItem = sessionStorage.getItem(key);
if (!storageItem) {
return null;
}
return JSON.parse(storageItem) as any;
};
public static set = (key: string, value: any) => {
sessionStorage.setItem(key, JSON.stringify(value));
};
public static remove = (key: string) => {
sessionStorage.removeItem(key);
};
}