TOSIT-IO / tdp-ui

Graphical interface for tdp-server
Apache License 2.0
4 stars 2 forks source link

Pass TDP client API as a Redux middleware #173

Closed PaulFarault closed 1 year ago

PaulFarault commented 1 year ago

Currently, an instance of the TDP client API is initialized (after authentication and config loading) and store in a context. To fetch data (variables for example):

  1. The client is used directly inside the component
  2. The fetch result is then passed to Redux
  3. A selector is finally used to update the page based on the Redux store

It would be best to pass the client as a Redux middleware and to fetch data directly with Redux using thunks.

PaulFarault commented 1 year ago

Would be interesting to study if using RTK Query along with their OpenAPI code generator would solve our problems.