class SessionCache { setCache(key, value) { window.sessionStorage.setItem(key, JSON.stringify(value)) } getCache(key) { // obj => string => obj const value = window.sessionStorage.getItem(key) if (value) { return JSON.parse(value) } else { return false } } deleteCache(key) { window.sessionStorage.removeItem(key) } clearCache() { window.sessionStorage.clear() } } export default new SessionCache()