mirror of
https://github.com/wekan/wekan.git
synced 2026-01-22 09:16:10 +01:00
add currentSetting to ReactiveCache
This commit is contained in:
parent
c6ee58ef88
commit
b7dbeba7de
13 changed files with 59 additions and 55 deletions
|
|
@ -31,6 +31,10 @@ ReactiveCacheServer = {
|
|||
const ret = CustomFields.find(selector).fetch();
|
||||
return ret;
|
||||
},
|
||||
getCurrentSetting() {
|
||||
const ret = Settings.findOne();
|
||||
return ret;
|
||||
},
|
||||
}
|
||||
|
||||
// only the Client is reactive
|
||||
|
|
@ -106,6 +110,16 @@ ReactiveCacheClient = {
|
|||
}
|
||||
const ret = this.__customFields.get(Jsons.stringify(selector));
|
||||
return ret;
|
||||
},
|
||||
getCurrentSetting() {
|
||||
if (!this.__currentSetting || !this.__currentSetting.get()) {
|
||||
this.__currentSetting = new DataCache(() => {
|
||||
const _ret = Settings.findOne();
|
||||
return _ret;
|
||||
});
|
||||
}
|
||||
const ret = this.__currentSetting.get();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -179,6 +193,15 @@ ReactiveCache = {
|
|||
}
|
||||
return ret;
|
||||
},
|
||||
getCurrentSetting() {
|
||||
let ret;
|
||||
if (Meteor.isServer) {
|
||||
ret = ReactiveCacheServer.getCurrentSetting();
|
||||
} else {
|
||||
ret = ReactiveCacheClient.getCurrentSetting();
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
}
|
||||
|
||||
export { ReactiveCache };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue