next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

How to pass a custom header when using drupal.getMenu that is not globally applied ?

Open jean-pasqualini opened this issue 1 year ago • 1 comments

Package

next-drupal (NPM package)

Ask the question

Basically, I'm using SSR render on next.js and I want to use drupal.getMenu passing the header cf-ipcountry that i receive on each request depending on the user's country. this isn't related to translation of the menu.

for regulatory reason, i have a case where depending on the country the menu tree change slightly. on drupal side i have only menu and some items are not render in the json of the menu tree if they are not allowed to be displayed in this country.

i saw that it is possible to pass some custom header globally when initializing the drupal client but i didn't found any solution to pass a custom header dynamically when we use the fonction drupal.getMenu.

Maybe i'm wrong so i'm asking to you if that exists, or if we could have a such feature at the call level for getMenu and the others functions line getResourceCollection and so on as well.

jean-pasqualini avatar Sep 13 '24 12:09 jean-pasqualini

for now my alternative is to create one drupal client instance by country

jean-pasqualini avatar Sep 13 '24 13:09 jean-pasqualini