appbaseio / reactivesearch

Search UI components for React and Vue
https://opensource.appbase.io/reactivesearch
Apache License 2.0
4.89k stars 470 forks source link

The headers are not being passed to request #1536

Open jyxia opened 3 years ago

jyxia commented 3 years ago

In our app, we are passing customized headers to initReactivesearch and not seeing the customized headers being passed to the actual request. I think the reason is that the headers always got set to an empty object {} in this line https://github.com/appbaseio/appbase-js/blob/develop/src/core/index.js#L58.

Shouldn't this line be this.headers = config.headers || {}? otherwise any AppBase instance would always have an empty object in headers.

bietkul commented 3 years ago

You can use setHeaders method on appbase instance.

jyxia commented 3 years ago

@bietkul Hey thanks, I saw that method. But we're using initReactivesearch in ReactiveSearch to initialize the initial state on SSR, do we have the access to the AppBase instance in there? see here: https://github.com/appbaseio/reactivesearch/blob/99dfb90083710ea6d96a4ca9e94280a88bc5a599/packages/web/src/server/index.js#L91

initReactivesearch instantiate AppBase with the headers passed in from settings and didn't use setHeaders. Should I file an issue in ReactiveSearch then?

jyxia commented 3 years ago

@bietkul can you please provide some input? I know this issue was closed, but it would be helpful if you can kindly reply. Thanks.

bietkul commented 3 years ago

@jyxia Please file an issue on ReactiveSearch instead. It is not an issue with appbase-js.

ashishcas commented 2 years ago

can i work on this @bietkul