File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -113,10 +113,6 @@ export const useDrupalCe = () => {
113113 const baseMenuPath = config . menuEndpoint . replace ( '$$$NAME$$$' , name )
114114 const menuPath = ref ( baseMenuPath )
115115
116- if ( config . exposeAPIRouteRules ) {
117- useFetchOptions . baseURL = '/api/menu'
118- }
119-
120116 if ( config . useLocalizedMenuEndpoint && nuxtApp . $i18n ) {
121117 // API path with localization
122118 menuPath . value = nuxtApp . $localePath ( '/' + baseMenuPath )
@@ -125,6 +121,14 @@ export const useDrupalCe = () => {
125121 } )
126122 }
127123
124+ if ( config . exposeAPIRouteRules ) {
125+ useFetchOptions . baseURL = '/api/menu'
126+ // menuPath should not start with a slash.
127+ if ( menuPath . value . startsWith ( '/' ) ) {
128+ menuPath . value = menuPath . value . substring ( 1 )
129+ }
130+ }
131+
128132 const { data : menu , error } = await useFetch ( menuPath , useFetchOptions )
129133
130134 if ( error . value ) {
You can’t perform that action at this time.
0 commit comments