clowder-framework / clowder2

Clowder v2 (in development)
Apache License 2.0
11 stars 5 forks source link

reactive search routes when token expire logout #132

Closed longshuicy closed 1 year ago

longshuicy commented 1 year ago

when token expire, need to figure out how to know and how to log out of clowder

<ReactiveBase
      url="http://localhost:8000/api/v2/elasticsearch"
      app="dataset"
      headers={{"Authorization": cookies.get("Authorization")}}
    >

the requests are handled internally by the reactivesearch library; need to research on that

longshuicy commented 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>