Skip to content

Commit

Permalink
Merge pull request #52 from storyblok/hotfix/provide-new-language-param
Browse files Browse the repository at this point in the history
Hotfix/provide new language param
  • Loading branch information
onefriendaday authored Apr 30, 2021
2 parents 7f321f8 + c71558d commit cd53e69
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ exports.sourceNodes = async function({ actions }, options) {
})

const space = await Sync.getSpace()
const languages = (options.languages ? options.languages : space.language_codes).map((lang) => { return lang + '/*' })
const languages = options.languages ? options.languages : space.language_codes
languages.push('')

for (const language of languages) {
Expand Down
14 changes: 7 additions & 7 deletions 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
Expand Up @@ -5,7 +5,7 @@
"author": "Alexander Feiglstorfer <[email protected]>",
"dependencies": {
"json-stringify-safe": "^5.0.1",
"storyblok-js-client": "^4.0.5"
"storyblok-js-client": "^4.0.6"
},
"scripts": {
"test": "jest"
Expand Down
2 changes: 1 addition & 1 deletion src/getStoryParams.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getStoryParams = function(language = '', options = {}) {
}

if (language.length > 0) {
params.starts_with = language
params.language = language
}

return params
Expand Down
8 changes: 4 additions & 4 deletions tests/get-story-params.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('getStoryParams() function', () => {
resolveLinks: 'story'
}
expect(getStoryParams('en', options)).toEqual({
starts_with: 'en',
language: 'en',
resolve_links: 'story'
})
})
Expand All @@ -20,7 +20,7 @@ describe('getStoryParams() function', () => {
resolveLinks: 'url'
}
expect(getStoryParams('en', options)).toEqual({
starts_with: 'en',
language: 'en',
resolve_links: 'url'
})
})
Expand All @@ -30,7 +30,7 @@ describe('getStoryParams() function', () => {
version: 'draft'
}
expect(getStoryParams('en', options)).toEqual({
starts_with: 'en',
language: 'en',
version: 'draft'
})
})
Expand All @@ -41,7 +41,7 @@ describe('getStoryParams() function', () => {
resolveRelations: ['page.author', 'page.categories']
}
expect(getStoryParams('en', options)).toEqual({
starts_with: 'en',
language: 'en',
version: 'draft',
resolve_relations: 'page.author,page.categories'
})
Expand Down

0 comments on commit cd53e69

Please sign in to comment.