function cacheBuild(data, key) { const cached = Utils.buildStoragePayload(data); Cache.store(key, cached); return cached; }
getProfileProperties().then(function(properties) { // we have a layout in the user profile, return this... const layoutFromProperties = getPropertyData('layout'); if (layoutFromProperties.length === 0) { // no profile properties setup, use the defaults... resolve(getDefaultLayout()); } else if (typeof cachedResults === 'undefined') { resolve(layoutFromProperties); } else { // we have a value, update the cache silently Cache.store(LAYOUT_STORAGE_KEY, Utils.buildStoragePayload(layoutFromProperties)); } }).catch(function(reason) {
getProfileProperties().then(function(properties) { const settingsFromProperties = getPropertyData('settings'); if (settingsFromProperties.length === 0) { // no profile properties setup, use the defaults... resolve(Utils.buildStoragePayload(getDefaultSettings()).payload); } else if (typeof settings === 'undefined') { // we have their settings in the user profile, return this... resolve(settingsFromProperties); } else { // we have a value, update the cache silently Cache.store(SETTINGS_STORAGE_KEY, Utils.buildStoragePayload(settingsFromProperties)); } }).catch(function(reason) {
getProfileProperties().then(function(properties) { const favouritesFromProperties = getPropertyData('favourites'); if (favouritesFromProperties.length === 0) { // no profile properties setup, use the defaults... resolve(Utils.buildStoragePayload(getDefaultFavourites()).payload); } else if (typeof favourites === 'undefined') { // we have their favourites in the user profile, return this... resolve(favouritesFromProperties); } else { // we have a value, update the cache silently Cache.store(FAVOURITES_STORAGE_KEY, Utils.buildStoragePayload(favouritesFromProperties)); } }).catch(function(reason) {
function(results) { if (typeof results === 'undefined') { getBusinessInformation(keys, id); } else { data[key].complete = true; } if (Object.keys(data).every(info => data[info].complete)) { collection = Object.keys(data).map(function(item) { return data[item]; }); resolve(collection); // save this in the local storage so we don't need to fetch this next time Cache.store(USERINFO_STORAGE_KEY, Utils.buildStoragePayload(collection)); } else if (data[key].complete) { // move onto the next one getBusinessInformation(keys); } }