src/utils/Storage.js
const PREFIX = 'sippo.storage.';
/**
* Get a previous stored value with given name.
* @param {string} name
* @return {object} previous stored object or null if not found.
* @private
*/
export function getItem(name) {
return JSON.parse(localStorage.getItem(PREFIX + name));
}
/**
* Store a value with an associated name.
* @param {string} name
* @param {object} value
* @private
*/
export function setItem(name, value) {
localStorage.setItem(PREFIX + name, JSON.stringify(value));
}
/**
* Remove the item with the associated name.
* @param {string} name
* @private
*/
export function removeItem(name) {
localStorage.removeItem(PREFIX + name);
}