From 51bc01af9687d124af4d38789787ff1aefe47901 Mon Sep 17 00:00:00 2001 From: Hugo Zigha Date: Tue, 20 Aug 2024 13:55:15 +0200 Subject: [PATCH] MT#60711 removing lang parameter when we use api v2 Due to some changes on api v2, we cannot pass a parameter that doesn't exist to api. In csc, we put the lang parameter in each call but it returns an error when using api v2. So in the case we use api v2 we just removed this parameter. Change-Id: Ib9e5decc67178d65626a285688e41b88b16e0b03 --- src/api/common.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/api/common.js b/src/api/common.js index 44569ece..ae6d4517 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -84,16 +84,19 @@ export function initAPI ({ baseURL }) { if (config.method === 'POST' && (config.data === undefined || config.data === null)) { config.data = {} } - if (config.params) { - config.params = { - ...config.params, - lang: getCurrentLangAsV1Format() - } - } else { - config.params = { - lang: getCurrentLangAsV1Format() + if (!config?.url.includes('v2')) { + if (config.params) { + config.params = { + ...config.params, + lang: getCurrentLangAsV1Format() + } + } else { + config.params = { + lang: getCurrentLangAsV1Format() + } } } + return config } })