From 1dad013d606ccce997ae527461d0af9908836cd0 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sun, 1 Nov 2020 11:23:15 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=B1=D0=B0=D0=B3=20=D1=81=D0=B8=D0=BD=D1=85?= =?UTF-8?q?=D1=80=D0=BE=D0=BD=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8=20=D0=BF?= =?UTF-8?q?=D1=80=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B2=D0=BE=D0=BC=20=D0=B2?= =?UTF-8?q?=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B8=D0=B8=20=D0=BE=D0=BF?= =?UTF-8?q?=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reader/ServerStorage/ServerStorage.vue | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/client/components/Reader/ServerStorage/ServerStorage.vue b/client/components/Reader/ServerStorage/ServerStorage.vue index d28e3dd0..b6092ddb 100644 --- a/client/components/Reader/ServerStorage/ServerStorage.vue +++ b/client/components/Reader/ServerStorage/ServerStorage.vue @@ -69,15 +69,15 @@ class ServerStorage extends Vue { try { this.cachedRecent = await ssCacheStore.getItem('recent'); if (!this.cachedRecent) - await this.setCachedRecent({rev: 0, data: {}}); + await this.cleanCachedRecent('cachedRecent'); this.cachedRecentPatch = await ssCacheStore.getItem('recent-patch'); if (!this.cachedRecentPatch) - await this.setCachedRecentPatch({rev: 0, data: {}}); + await this.cleanCachedRecent('cachedRecentPatch'); this.cachedRecentMod = await ssCacheStore.getItem('recent-mod'); if (!this.cachedRecentMod) - await this.setCachedRecentMod({rev: 0, data: {}}); + await this.cleanCachedRecent('cachedRecentMod'); if (!this.serverStorageKey) { //генерируем новый ключ @@ -105,6 +105,15 @@ class ServerStorage extends Vue { this.cachedRecentMod = value; } + async cleanCachedRecent(whatToClean) { + if (whatToClean == 'cachedRecent' || whatToClean == 'all') + await this.setCachedRecent({rev: 0, data: {}}); + if (whatToClean == 'cachedRecentPatch' || whatToClean == 'all') + await this.setCachedRecentPatch({rev: 0, data: {}}); + if (whatToClean == 'cachedRecentMod' || whatToClean == 'all') + await this.setCachedRecentMod({rev: 0, data: {}}); + } + async generateNewServerStorageKey() { const key = utils.toBase58(utils.randomArray(32)); this.commit('reader/setServerStorageKey', key); @@ -134,9 +143,12 @@ class ServerStorage extends Vue { await this.currentProfileChanged(force); await this.loadLibs(force); + if (force) + await this.cleanCachedRecent('all'); const loadSuccess = await this.loadRecent(); - if (loadSuccess && force) + if (loadSuccess && force) { await this.saveRecent(); + } } }