Skip to content

Commit

Permalink
refactor(core): restore middleware definition in integrationPlugin (#…
Browse files Browse the repository at this point in the history
…6702)

* refactor(core): restore middleware definition in `integrationPlugin`

* chore: syntax

Co-authored-by: Lukas Borawski <lukas.borawski@gmail.com>
  • Loading branch information
bloodf and lukasborawski authored May 20, 2022
1 parent d2c1fb2 commit 4d0b314
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/core/core/src/utils/nuxt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ 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) {
Expand Down

0 comments on commit 4d0b314

Please sign in to comment.