Рефакторинг, улучшение отображения версии

This commit is contained in:
Book Pauk
2022-10-09 20:41:42 +07:00
parent 578efbd110
commit 0dc30e730d
3 changed files with 2 additions and 18 deletions

View File

@@ -92,16 +92,8 @@ class Api {
async updateConfig() {
try {
const config = await this.getConfig();
config.webAppVersion = packageJson.version;
this.commit('setConfig', config);
//проверим на новую версию, обновимся при необходимости
if (this.config.version) {
if (this.config.version != packageJson.version && Date.now() - this.lastReloadTime > 15*1000) {
this.commit('setLastReloadTime', Date.now());//на всякий случай, чтобы исключить зацикливание в reload
document.location.reload();
}
}
} catch (e) {
this.$root.stdDialog.alert(e.message, 'Ошибка');
}
@@ -111,10 +103,6 @@ class Api {
return this.$store.state.config;
}
get lastReloadTime() {
return this.$store.state.lastReloadTime;
}
get settings() {
return this.$store.state.settings;
}