Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Resolve conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: denisgoryaynov <denis.gor27@gmail.com>
  • Loading branch information
denisgoryaynov committed Apr 15, 2020
2 parents f01eca1 + 2d5d641 commit 4945319
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gatsby-source-strapi",
"version": "0.0.12",
"version": "0.0.13",
"description": "Gatsby source plugin for building websites using Strapi as a data source",
"author": {
"email": "hi@strapi.io",
Expand Down
14 changes: 9 additions & 5 deletions src/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ module.exports = async ({
singleType,
jwtToken,
queryLimit,
reporter
reporter,
}) => {
// Define API endpoint.
let apiBase = singleType ? `${apiURL}/${singleType}` : `${apiURL}/${pluralize(contentType)}`

let apiBase = singleType
? `${apiURL}/${singleType}`
: `${apiURL}/${pluralize(contentType)}`

const apiEndpoint = `${apiBase}?_limit=${queryLimit}`

reporter.info(`Starting to fetch data from Strapi - ${apiEndpoint}`)
Expand All @@ -29,7 +31,9 @@ module.exports = async ({
const documents = await axios(apiEndpoint, fetchRequestConfig)

// Make sure response is an array for single type instances
const response = Array.isArray(documents.data) ? documents.data : [ documents.data ]
const response = Array.isArray(documents.data)
? documents.data
: [documents.data]

// Map and clean data.
return response.map(item => clean(item))
Expand All @@ -41,7 +45,7 @@ module.exports = async ({
* @param {object} item - Entry needing clean
* @returns {object} output - Object cleaned
*/
const clean = (item) => {
const clean = item => {
forEach(item, (value, key) => {
if (startsWith(key, `__`)) {
delete item[key]
Expand Down
4 changes: 2 additions & 2 deletions src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports.sourceNodes = async (
contentType,
jwtToken,
queryLimit,
reporter
reporter,
})
)

Expand All @@ -42,7 +42,7 @@ exports.sourceNodes = async (
singleType,
jwtToken,
queryLimit,
reporter
reporter,
})
)

Expand Down

0 comments on commit 4945319

Please sign in to comment.