class LocalCache {
|
setCache(key: string, value: any) {
|
window.localStorage.setItem(key, JSON.stringify(value));
|
}
|
getCache(key: string) {
|
const value = window.localStorage.getItem(key);
|
if (value != undefined) {
|
return JSON.parse(value);
|
}else {
|
return '';
|
}
|
}
|
deleteCache(key: string) {
|
window.localStorage.removeItem(key);
|
}
|
clearCache() {
|
window.localStorage.clear();
|
}
|
}
|
|
export default new LocalCache();
|