Мелкая оптимизация, чтобы не отдавал большой конфиг каждый раз при обновлении страницы
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
import wsc from './webSocketConnection';
|
||||
|
||||
class Misc {
|
||||
async loadConfig() {
|
||||
async loadConfig(_configHash) {
|
||||
|
||||
const query = {params: [
|
||||
'name', 'version', 'mode', 'maxUploadFileSize', 'useExternalBookConverter',
|
||||
'acceptFileExt', 'bucEnabled', 'branch', 'networkLibraryLink', 'restricted'
|
||||
]};
|
||||
const query = {
|
||||
params: [
|
||||
'name', 'version', 'mode', 'maxUploadFileSize', 'useExternalBookConverter',
|
||||
'acceptFileExt', 'bucEnabled', 'branch', 'networkLibraryLink', 'restricted'
|
||||
],
|
||||
_configHash,
|
||||
};
|
||||
|
||||
const config = await wsc.message(await wsc.send(Object.assign({action: 'get-config'}, query)));
|
||||
if (config.error)
|
||||
|
||||
@@ -154,8 +154,11 @@ class App {
|
||||
(async() => {
|
||||
//загрузим конфиг сервера
|
||||
try {
|
||||
const config = await miscApi.loadConfig();
|
||||
this.commit('config/setConfig', config);
|
||||
const config = await miscApi.loadConfig(this.config._configHash);
|
||||
|
||||
if (!config._useCached)
|
||||
this.commit('config/setConfig', config);
|
||||
|
||||
this.showPage = true;
|
||||
} catch(e) {
|
||||
//проверим, не получен ли конфиг ранее
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import miscApi from '../../api/misc';
|
||||
// initial state
|
||||
const state = {
|
||||
name: null,
|
||||
|
||||
Reference in New Issue
Block a user