From a13146d722bf075c17e19473a81753dc86e38293 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Sun, 17 Mar 2019 16:14:03 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=20=D0=BD?= =?UTF-8?q?=D0=B0=D0=B4=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D1=8F=D0=BC?= =?UTF-8?q?=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reader/ServerStorage/ServerStorage.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client/components/Reader/ServerStorage/ServerStorage.vue b/client/components/Reader/ServerStorage/ServerStorage.vue index d621c361..5807f368 100644 --- a/client/components/Reader/ServerStorage/ServerStorage.vue +++ b/client/components/Reader/ServerStorage/ServerStorage.vue @@ -36,6 +36,7 @@ class ServerStorage extends Vue { this.oldProfiles = this.profiles; await this.loadProfiles(); + this.checkCurrentProfile(); } get settings() { @@ -58,6 +59,12 @@ class ServerStorage extends Vue { return this.$store.state.reader.currentProfile; } + checkCurrentProfile() { + if (!this.profiles[this.currentProfile]) { + this.commit('reader/setCurrentProfile', ''); + } + } + notifySuccessIfNeeded(rev1, rev2) { if (rev1 != rev2) this.$notify.success({message: 'Данные синхронизированы с сервером'}); @@ -89,10 +96,6 @@ class ServerStorage extends Vue { this.oldProfiles = this.profiles; - if (!this.profiles[this.currentProfile]) { - this.commit('reader/setCurrentProfile', ''); - } - this.notifySuccessIfNeeded(oldRev, prof.rev); } else { this.warning(`Неверный ответ сервера: ${prof.state}`); @@ -125,9 +128,7 @@ class ServerStorage extends Vue { if (tries >= maxSetTries) { this.commit('reader/setProfiles', this.oldProfiles); - if (!this.profiles[this.currentProfile]) { - this.commit('reader/setCurrentProfile', ''); - } + this.checkCurrentProfile(); this.error('Не удалось отправить данные на сервер'); } else { this.oldProfiles = this.profiles;