From 2a0d1dcfce980dbe08f41170f6df8eddd1b4d2fd Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Mon, 25 Mar 2019 13:06:48 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B1=D0=B0=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reader/ServerStorage/ServerStorage.vue | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/client/components/Reader/ServerStorage/ServerStorage.vue b/client/components/Reader/ServerStorage/ServerStorage.vue index ac7810a1..bff2f2df 100644 --- a/client/components/Reader/ServerStorage/ServerStorage.vue +++ b/client/components/Reader/ServerStorage/ServerStorage.vue @@ -37,6 +37,7 @@ export default @Component({ class ServerStorage extends Vue { created() { this.inited = false; + this.keyInited = false; this.commit = this.$store.commit; this.prevServerStorageKey = null; this.$root.$on('generateNewServerStorageKey', () => {this.generateNewServerStorageKey()}); @@ -88,7 +89,8 @@ class ServerStorage extends Vue { if (this.prevServerStorageKey != this.serverStorageKey) { this.prevServerStorageKey = this.serverStorageKey; this.hashedStorageKey = utils.toBase58(cryptoUtils.sha256(this.serverStorageKey)); - + this.keyInited = true; + await this.loadProfiles(force); this.checkCurrentProfile(); await this.currentProfileChanged(force); @@ -163,7 +165,7 @@ class ServerStorage extends Vue { } async loadSettings(force) { - if (!this.serverSyncEnabled || !this.currentProfile) + if (!this.keyInited || !this.serverSyncEnabled || !this.currentProfile) return; const setsId = `settings-${this.currentProfile}`; @@ -206,7 +208,7 @@ class ServerStorage extends Vue { } async saveSettings() { - if (!this.serverSyncEnabled || !this.currentProfile || this.savingSettings) + if (!this.keyInited || !this.serverSyncEnabled || !this.currentProfile || this.savingSettings) return; const diff = utils.getObjDiff(this.oldSettings, this.settings); @@ -252,7 +254,7 @@ class ServerStorage extends Vue { } async loadProfiles(force) { - if (!this.serverSyncEnabled) + if (!this.keyInited || !this.serverSyncEnabled) return; const oldRev = this.profilesRev; @@ -294,7 +296,7 @@ class ServerStorage extends Vue { } async saveProfiles() { - if (!this.serverSyncEnabled || this.savingProfiles) + if (!this.keyInited || !this.serverSyncEnabled || this.savingProfiles) return; const diff = utils.getObjDiff(this.oldProfiles, this.profiles); @@ -346,7 +348,7 @@ class ServerStorage extends Vue { } async loadRecent(force) { - if (!this.serverSyncEnabled) + if (!this.keyInited || !this.serverSyncEnabled) return; const oldRev = bookManager.recentRev; @@ -416,7 +418,7 @@ class ServerStorage extends Vue { } async saveRecent() { - if (!this.serverSyncEnabled || this.savingRecent) + if (!this.keyInited || !this.serverSyncEnabled || this.savingRecent) return; const bm = bookManager; @@ -462,7 +464,7 @@ class ServerStorage extends Vue { } async saveRecentLast(force = false) { - if (!this.serverSyncEnabled || this.savingRecentLast) + if (!this.keyInited || !this.serverSyncEnabled || this.savingRecentLast) return; const bm = bookManager;