From 775630696680233a913d277ac3f4a85cc69229b4 Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 27 Nov 2020 17:19:03 +0100 Subject: [PATCH] Clear cache on logout --- www/common/outer/cache-store.js | 5 +++-- www/common/outer/local-store.js | 12 ++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) 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 () {