mirror of
https://github.com/chatwoot/chatwoot.git
synced 2026-06-19 21:07:35 +08:00
Co-authored-by: Sivin Varghese <[email protected]> Co-authored-by: Nithin David Thomas <[email protected]> Co-authored-by: Fayaz Ahmed <[email protected]> Co-authored-by: Pranav <[email protected]>
18 lines
342 B
JavaScript
18 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;
|