diff --git a/www/common/outer/cache-store.js b/www/common/outer/cache-store.js index 4d5e30ed2..6b6c8604e 100644 --- a/www/common/outer/cache-store.js +++ b/www/common/outer/cache-store.js @@ -82,8 +82,9 @@ define([ }); }; - S.clear = function () { - cache.clear(); + S.clear = function (cb) { + cb = Util.once(Util.mkAsync(cb || function () {})); + cache.clear(cb); }; return S; diff --git a/www/common/outer/local-store.js b/www/common/outer/local-store.js index 0aff1f9ce..645493de5 100644 --- a/www/common/outer/local-store.js +++ b/www/common/outer/local-store.js @@ -1,9 +1,10 @@ define([ '/common/common-constants.js', '/common/common-hash.js', + '/common/outer/cache-store.js', '/bower_components/localforage/dist/localforage.min.js', '/customize/application_config.js', -], function (Constants, Hash, localForage, AppConfig) { +], function (Constants, Hash, Cache, localForage, AppConfig) { var LocalStore = {}; LocalStore.setThumbnail = function (key, value, cb) { @@ -119,7 +120,14 @@ define([ return void AppConfig.customizeLogout(cb); } - if (cb) { cb(); } + cb = cb || function () {}; + + try { + Cache.clear(cb); + } catch (e) { + console.error(e); + cb(); + } }; var loginHandlers = []; LocalStore.loginReload = function () {