From 7331bdee3378806d2a11ba189f00179d2c1d55fc Mon Sep 17 00:00:00 2001 From: Heitor Ramon Ribeiro Date: Fri, 8 Apr 2022 09:21:58 -0300 Subject: [PATCH 1/2] refactor(core): restore middleware definition in `integrationPlugin` --- packages/core/core/src/utils/nuxt/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/core/src/utils/nuxt/index.ts b/packages/core/core/src/utils/nuxt/index.ts index 9087a86f7a..394b3fc9ce 100644 --- a/packages/core/core/src/utils/nuxt/index.ts +++ b/packages/core/core/src/utils/nuxt/index.ts @@ -25,8 +25,14 @@ export const integrationPlugin = (pluginFn: NuxtPlugin) => (nuxtCtx: NuxtContext const configure = (tag, configuration) => { const injectInContext = createAddIntegrationToCtx({ tag, nuxtCtx, inject }); const config = getIntegrationConfig(nuxtCtx, configuration); - const client = axios.create(config.axios); + const { middlewareUrl, ssrMiddlewareUrl } = nuxtCtx.$config; + + if (middlewareUrl) { + config.axios.baseURL = process.server ? middlewareUrl || ssrMiddlewareUrl : middlewareUrl; + } + + const client = axios.create(config.axios); const api = createProxiedApi({ givenApi: configuration.api || {}, client, tag }); if (nuxtCtx.app.i18n.cookieValues) { From d13f2e52528ae2a79e7c06cf63d773ac05fadcd9 Mon Sep 17 00:00:00 2001 From: Lukas Borawski Date: Thu, 12 May 2022 13:49:51 +0100 Subject: [PATCH 2/2] chore: syntax --- packages/core/core/src/utils/nuxt/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/core/core/src/utils/nuxt/index.ts b/packages/core/core/src/utils/nuxt/index.ts index 394b3fc9ce..a729ffb2e2 100644 --- a/packages/core/core/src/utils/nuxt/index.ts +++ b/packages/core/core/src/utils/nuxt/index.ts @@ -27,7 +27,6 @@ export const integrationPlugin = (pluginFn: NuxtPlugin) => (nuxtCtx: NuxtContext const config = getIntegrationConfig(nuxtCtx, configuration); const { middlewareUrl, ssrMiddlewareUrl } = nuxtCtx.$config; - if (middlewareUrl) { config.axios.baseURL = process.server ? middlewareUrl || ssrMiddlewareUrl : middlewareUrl; }