This repository was archived by the owner on Jun 4, 2024. It is now read-only.
This repository was archived by the owner on Jun 4, 2024. It is now read-only.
Request Hooks #65
Closed
Description
The API requests that Dash's front-end makes should be configurable. In order to make them configurable, we will need to do the following things:
- We will need to make the Dash Front-end (
dash-renderer
) a standalone library that can be initialized and invoked from other libraries - We will need to extend the
dash-renderer
to take a set of config input parameters - Some of these input parameters will be functions or promises that we will call before certain actions
- For this issue, we will start by a
request_pre
andrequest_post
parameter that will be called before and after HTTP requests with the entire request and response objects. This will enable the developer to transform the data before and after network requests.
Example:
dash_renderer({
request_pre: requestPayload => {
return modifyRequest(requestPayload);
},
request_post: (requestPayload, responsePayload) => {
return modifyResponse(requestPayload, responsePayload)
}
})
So, the hooks are only the network requests. In the code, this would fit in here:
dash-renderer/src/actions/index.js
Lines 447 to 455 in 70bb93e
Note that in order for users to supply their own arguments, I believe they would need to provide their own instance of dash_renderer
by overriding the index file (as discussed here: plotly/dash#265)