18 lines
457 B
TypeScript
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);
|
|
};
|
|
}
|