import init from '@utils/instance'; import Store from './Store'; const storageInstance = init(); class LocalStorage { constructor() { const instance = storageInstance(); if (instance) return instance; storageInstance(this); } set = (key: any, value: any, ttl?: any) => { const setLS = !ttl ? Store.set : Store.expireSet; setLS(key, JSON.stringify(value), ttl); }; get = (key: any) => { const s = Store.get(key); return s ? JSON.parse(s) : null; }; exprieGet = (key: any) => { const s = Store.expireGet(key); return s ? JSON.parse(s) : null; }; remove = (key: any) => { Store.remove(key); }; } export default new LocalStorage();