0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Reworked routeSettings service public API

refs 4da7e7f0cb
refs https://linear.app/tryghost/issue/CORE-35/refactor-route-and-redirect-settings

- This rework is mean to give cleaner separation over methods used by the API and internal methods
This commit is contained in:
Naz 2021-09-23 18:31:13 +02:00 committed by naz
parent 31e9434466
commit 4b80fe1ab3
4 changed files with 10 additions and 8 deletions

View file

@ -190,7 +190,7 @@ module.exports = {
method: 'edit'
},
async query(frame) {
await routeSettings.setFromFilePath(frame.file.path);
await routeSettings.api.setFromFilePath(frame.file.path);
const getRoutesHash = () => frontendSettings.getCurrentHash();
await settingsService.syncRoutesHash(getRoutesHash);
}
@ -210,7 +210,7 @@ module.exports = {
method: 'browse'
},
query() {
return routeSettings.get();
return routeSettings.api.get();
}
}
};

View file

@ -168,7 +168,7 @@ module.exports = {
method: 'edit'
},
async query(frame) {
await routeSettings.setFromFilePath(frame.file.path);
await routeSettings.api.setFromFilePath(frame.file.path);
const getRoutesHash = () => frontendSettings.getCurrentHash();
await settingsService.syncRoutesHash(getRoutesHash);
}
@ -188,7 +188,7 @@ module.exports = {
method: 'browse'
},
query() {
return routeSettings.get();
return routeSettings.api.get();
}
}
};

View file

@ -194,7 +194,7 @@ module.exports = {
method: 'edit'
},
async query(frame) {
await routeSettings.setFromFilePath(frame.file.path);
await routeSettings.api.setFromFilePath(frame.file.path);
const getRoutesHash = () => frontendSettings.getCurrentHash();
await settingsService.syncRoutesHash(getRoutesHash);
}
@ -214,7 +214,7 @@ module.exports = {
method: 'browse'
},
query() {
return routeSettings.get();
return routeSettings.api.get();
}
}
};

View file

@ -143,6 +143,8 @@ const init = function () {
return ensureSettingsFile('routes.yaml');
};
module.exports.setFromFilePath = setFromFilePath;
module.exports.get = get;
module.exports.init = init;
module.exports.api = {
setFromFilePath: setFromFilePath,
get: get
};