8c8c5a77c8
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com> Co-authored-by: Fayaz Ahmed <15716057+fayazara@users.noreply.github.com> Co-authored-by: Pranav <pranav@chatwoot.com>
17 lines
342 B
JavaScript
17 lines
342 B
JavaScript
class LocalStorage {
|
|
constructor(key) {
|
|
this.key = key;
|
|
}
|
|
|
|
store(allItems) {
|
|
localStorage.setItem(this.key, JSON.stringify(allItems));
|
|
localStorage.setItem(this.key + ':ts', Date.now());
|
|
}
|
|
|
|
get() {
|
|
let stored = localStorage.getItem(this.key);
|
|
return JSON.parse(stored) || [];
|
|
}
|
|
}
|
|
|
|
export default LocalStorage;
|