mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Exposed config initialization from Resources
refs https://github.com/TryGhost/Toolbox/issues/125 - Config initialization for the URL Resouces is a separate stage which doesn't have to be bundled along with resouce fetching method - It gives even more flexibility when composing different ways to get the "resources" loaded into memory: right now it's from the DB but could come from a cache
This commit is contained in:
parent
963df37aaa
commit
b707f325c8
1 changed files with 2 additions and 7 deletions
|
@ -43,13 +43,12 @@ class Resources {
|
|||
}
|
||||
|
||||
/**
|
||||
* @description Initialise the resource config. We currently fetch the data straight via the the model layer,
|
||||
* @description Initialize the resource config. We currently fetch the data straight via the the model layer,
|
||||
* but because Ghost supports multiple API versions, we have to ensure we load the correct data.
|
||||
*
|
||||
* @TODO: https://github.com/TryGhost/Ghost/issues/10360
|
||||
* @private
|
||||
*/
|
||||
_initResourceConfig() {
|
||||
initResourceConfig() {
|
||||
if (!_.isEmpty(this.resourcesConfig)) {
|
||||
return;
|
||||
}
|
||||
|
@ -66,8 +65,6 @@ class Resources {
|
|||
const ops = [];
|
||||
debug('fetchResources');
|
||||
|
||||
this._initResourceConfig();
|
||||
|
||||
// NOTE: Iterate over all resource types (posts, users etc..) and call `_fetch`.
|
||||
_.each(this.resourcesConfig, (resourceConfig) => {
|
||||
this.data[resourceConfig.type] = [];
|
||||
|
@ -442,8 +439,6 @@ class Resources {
|
|||
* @description Reset this class instance.
|
||||
*
|
||||
* Is triggered if you switch API versions.
|
||||
*
|
||||
* @param {Object} options
|
||||
*/
|
||||
reset() {
|
||||
_.each(this.listeners, (obj) => {
|
||||
|
|
Loading…
Reference in a new issue