From ec721576b9ccac6ac0c9c369d54978d918a6b32d Mon Sep 17 00:00:00 2001 From: Alexander Feiglstorfer Date: Fri, 30 Apr 2021 14:52:07 -0300 Subject: [PATCH 1/2] fix: fixes multi language query for v2 api --- gatsby-node.js | 2 +- package.json | 2 +- src/getStoryParams.js | 2 +- tests/get-story-params.test.js | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gatsby-node.js b/gatsby-node.js index 43b1dbb5e..b5e3d3cd7 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -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) { diff --git a/package.json b/package.json index a3710d205..5628991ab 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "author": "Alexander Feiglstorfer ", "dependencies": { "json-stringify-safe": "^5.0.1", - "storyblok-js-client": "^4.0.5" + "storyblok-js-client": "^4.0.6" }, "scripts": { "test": "jest" diff --git a/src/getStoryParams.js b/src/getStoryParams.js index 4b746649a..e5f5f38c2 100644 --- a/src/getStoryParams.js +++ b/src/getStoryParams.js @@ -22,7 +22,7 @@ const getStoryParams = function(language = '', options = {}) { } if (language.length > 0) { - params.starts_with = language + params.language = language } return params diff --git a/tests/get-story-params.test.js b/tests/get-story-params.test.js index b76d34a38..6e557a730 100644 --- a/tests/get-story-params.test.js +++ b/tests/get-story-params.test.js @@ -10,7 +10,7 @@ describe('getStoryParams() function', () => { resolveLinks: 'story' } expect(getStoryParams('en', options)).toEqual({ - starts_with: 'en', + language: 'en', resolve_links: 'story' }) }) @@ -20,7 +20,7 @@ describe('getStoryParams() function', () => { resolveLinks: 'url' } expect(getStoryParams('en', options)).toEqual({ - starts_with: 'en', + language: 'en', resolve_links: 'url' }) }) @@ -30,7 +30,7 @@ describe('getStoryParams() function', () => { version: 'draft' } expect(getStoryParams('en', options)).toEqual({ - starts_with: 'en', + language: 'en', version: 'draft' }) }) @@ -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' }) From c71558df023adc52940f0374497b7a123d1b436f Mon Sep 17 00:00:00 2001 From: Alexander Feiglstorfer Date: Fri, 30 Apr 2021 14:55:27 -0300 Subject: [PATCH 2/2] chore: update lockfile --- package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 77728e2af..cd342a1fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "license": "MIT", "dependencies": { "json-stringify-safe": "^5.0.1", - "storyblok-js-client": "^4.0.5" + "storyblok-js-client": "^4.0.6" }, "devDependencies": { "axios": "^0.21.1", @@ -7853,9 +7853,9 @@ } }, "node_modules/storyblok-js-client": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/storyblok-js-client/-/storyblok-js-client-4.0.5.tgz", - "integrity": "sha512-izjMXUUGT0+hyBXSXqT6ocEkeL+ZeMqhF168v/1uL7+vP841L0cOKnfA0yGml2LLfU5uFL83BF13xMpsPS2z7w==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/storyblok-js-client/-/storyblok-js-client-4.0.7.tgz", + "integrity": "sha512-XEymm8NxB9JQVQBDMtPYKQM4KM6D2FuWH/LkAkZVbWDBuurPgfNDP0Is01vDwe5+1+dRderITDAjGo0dq4VrHQ==", "dependencies": { "qs": "^6.9.4" }, @@ -15105,9 +15105,9 @@ "dev": true }, "storyblok-js-client": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/storyblok-js-client/-/storyblok-js-client-4.0.5.tgz", - "integrity": "sha512-izjMXUUGT0+hyBXSXqT6ocEkeL+ZeMqhF168v/1uL7+vP841L0cOKnfA0yGml2LLfU5uFL83BF13xMpsPS2z7w==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/storyblok-js-client/-/storyblok-js-client-4.0.7.tgz", + "integrity": "sha512-XEymm8NxB9JQVQBDMtPYKQM4KM6D2FuWH/LkAkZVbWDBuurPgfNDP0Is01vDwe5+1+dRderITDAjGo0dq4VrHQ==", "requires": { "qs": "^6.9.4" }