From 970475acbf9916c44b021abbf29bd4d398e8addd Mon Sep 17 00:00:00 2001 From: TurtlBbx Date: Tue, 9 Apr 2024 09:08:58 +0200 Subject: [PATCH] fix: Module fetching wrong menu URL when switching languages (#220) * fix: Fix module fetching wrong menu URL when switching languages. * Add build files for testing. * Remove dist --------- Co-authored-by: Alexandru --- src/runtime/composables/useDrupalCe/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/runtime/composables/useDrupalCe/index.ts b/src/runtime/composables/useDrupalCe/index.ts index cdba4aa6..65937d18 100644 --- a/src/runtime/composables/useDrupalCe/index.ts +++ b/src/runtime/composables/useDrupalCe/index.ts @@ -129,7 +129,12 @@ export const useDrupalCe = () => { // API path with localization menuPath.value = nuxtApp.$localePath('/' + baseMenuPath) watch(nuxtApp.$i18n.locale, () => { - menuPath.value = nuxtApp.$localePath('/' + baseMenuPath) + let menuLocalePath = nuxtApp.$localePath('/' + baseMenuPath) + // menuPath should not start with a slash. + if (config.serverApiProxy && menuLocalePath.startsWith('/')) { + menuLocalePath = menuLocalePath.substring(1) + } + menuPath.value = menuLocalePath }) }