@@ -21,7 +21,7 @@ module.exports = function GhostAdminAPI(options) {
21
21
// makeRequest (method)
22
22
// using es5 destructured parameters
23
23
// params and headers are optional parameters with an empty object as default value
24
- makeRequest ( { url, method, data, params = { } , headers = { } } ) {
24
+ makeRequest ( { url, method, data, params = { } , headers = { } } ) {
25
25
// axios: Promise based HTTP client for the browser and node.js
26
26
// Requests can be made by passing the relevant config to axios i.e axios(config)
27
27
return axios ( {
@@ -47,7 +47,7 @@ module.exports = function GhostAdminAPI(options) {
47
47
const config = Object . assign ( { } , defaultConfig , options ) ;
48
48
49
49
// new GhostAdminAPI({host: '...'}) is deprecated
50
-
50
+
51
51
if ( config . host ) {
52
52
// eslint-disable-next-line
53
53
console . warn ( `${ name } : The 'host' parameter is deprecated, please use 'url' instead` ) ;
@@ -295,7 +295,7 @@ module.exports = function GhostAdminAPI(options) {
295
295
return Promise . reject ( new Error ( 'Missing theme name' ) ) ;
296
296
}
297
297
298
- return makeResourceRequest ( 'themes' , { } , { } , 'PUT' , { id : `${ name } /activate` } ) ;
298
+ return makeResourceRequest ( 'themes' , { } , { } , 'PUT' , { id : `${ name } /activate` } ) ;
299
299
}
300
300
} ;
301
301
@@ -322,7 +322,7 @@ module.exports = function GhostAdminAPI(options) {
322
322
if ( ! Array . isArray ( data [ resourceType ] ) ) {
323
323
return data [ resourceType ] ;
324
324
}
325
-
325
+
326
326
if ( data [ resourceType ] . length === 1 && ! data . meta ) {
327
327
return data [ resourceType ] [ 0 ] ;
328
328
}
@@ -346,7 +346,7 @@ module.exports = function GhostAdminAPI(options) {
346
346
return data ;
347
347
}
348
348
if ( config . formatResponse === true ) {
349
- // return data[resourceType] if it is not an array
349
+ // return data[resourceType] if it is not an array
350
350
if ( ! Array . isArray ( data [ resourceType ] ) ) {
351
351
return data [ resourceType ] ;
352
352
}
@@ -355,17 +355,17 @@ module.exports = function GhostAdminAPI(options) {
355
355
return data [ resourceType ] [ 0 ] ;
356
356
}
357
357
//copy the values of all of the enumerable own properties from data.meta as meta data[resourceType]. Returns data[resourceType]
358
- return Object . assign ( data [ resourceType ] , { meta : data . meta } ) ;
358
+ return Object . assign ( data [ resourceType ] , { meta : data . meta } ) ;
359
359
} else {
360
- return Object . assign ( data , { meta : data . meta } ) ;
360
+ return Object . assign ( data , { meta : data . meta } ) ;
361
361
}
362
362
} ) ;
363
363
}
364
364
365
365
// function endpointFor: returns an endpoint for api request
366
- function endpointFor ( resource , { id, slug, email} = { } ) {
366
+ function endpointFor ( resource , { id, slug, email } = { } ) {
367
367
// destructure values from config
368
- const { ghostPath, version} = config ;
368
+ const { ghostPath, version } = config ;
369
369
// default endpoint
370
370
let endpoint = `/${ ghostPath } /api/${ version } /admin/${ resource } /` ;
371
371
@@ -383,8 +383,8 @@ module.exports = function GhostAdminAPI(options) {
383
383
return endpoint ;
384
384
}
385
385
386
- function makeApiRequest ( { endpoint, method, body, queryParams = { } , headers = { } } ) {
387
- const { url : apiUrl , key, version, makeRequest} = config ;
386
+ function makeApiRequest ( { endpoint, method, body, queryParams = { } , headers = { } } ) {
387
+ const { url : apiUrl , key, version, makeRequest } = config ;
388
388
const url = `${ apiUrl } ${ endpoint } ` ;
389
389
390
390
headers = Object . assign ( { } , headers , {
0 commit comments