Closed longshuicy closed 1 year ago
may leveraging transformResponse
https://docs.reactivesearch.io/docs/reactivesearch/v3/overview/reactivebase/
<ReactiveBase
app="appname"
credentials="abcdef123:abcdef12-ab12-ab12-ab12-abcdef123456"
headers={{
secret: 'reactivesearch-is-awesome'
}}
transformResponse={async (elasticsearchResponse, componentId) => { const ids = elasticsearchResponse.responses[0].hits.hits.map( item => item._id ); const extraInformation = await getExatraInformation(ids); const hits = elasticsearchResponse.responses[0].hits.hits.map( (item) => { const extraInformationItem = extraInformation.find( otherItem => otherItem._id === item._id ); return { ...item, ...extraInformationItem }; } ); return { response: [ { ...elasticsearchResponse.responses[0], hits: { ...elasticsearchResponse.responses[0].hits, hits } } ] }; }}
>
<Component1 .. />
<Component2 .. />
</ReactiveBase>
when token expire, need to figure out how to know and how to log out of clowder
the requests are handled internally by the reactivesearch library; need to research on that