mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Limited the keys pulled from Settings API
refs https://github.com/TryGhost/Team/issues/3009 - It's best to pull in as much data from the API as the app's state will ever use. Makes it explicit about what fields the app depends on instead of requesting a whole of "settings"
This commit is contained in:
parent
7270c17a1d
commit
5421ab5ab0
1 changed files with 6 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
function setupGhostApi({apiUrl, apiKey}) {
|
||||
function contentEndpointFor({resource, params = ''}) {
|
||||
function contentEndpointFor({resource, keys, params = ''}) {
|
||||
if (apiUrl && apiKey) {
|
||||
return `${apiUrl.replace(/\/$/, '')}/${resource}/?key=${apiKey}&limit=all${params}`;
|
||||
return `${apiUrl.replace(/\/$/, '')}/${resource}/?key=${apiKey}&keys=${keys.join(',')}${params}`;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
@ -19,7 +19,10 @@ function setupGhostApi({apiUrl, apiKey}) {
|
|||
|
||||
api.site = {
|
||||
settings() {
|
||||
const url = contentEndpointFor({resource: 'settings'});
|
||||
const url = contentEndpointFor({
|
||||
resource: 'settings',
|
||||
keys: ['announcement', 'announcement_background']
|
||||
});
|
||||
return makeRequest({
|
||||
url,
|
||||
method: 'GET',
|
||||
|
|
Loading…
Add table
Reference in a new issue