Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): prepare api base url for submodule #2998

Merged
merged 6 commits into from Jul 28, 2023

Conversation

jorgeepc
Copy link
Contributor

@jorgeepc jorgeepc commented Jul 27, 2023

This PR introduces changes to our api/redux functionality in the frontend app in order to support it as a git submodule.

Changes

  • refactor tracetest API redux toolkit to support dynamic baseUrl
  • implement the injectEndpoints method for RTK to inject endpoints into the original Tracetest API
  • update references to the new api module

Fixes

Checklist

  • tested locally
  • added new dependencies
  • updated the docs
  • added a test

@jorgeepc jorgeepc self-assigned this Jul 27, 2023
@jorgeepc jorgeepc marked this pull request as ready for review July 27, 2023 21:52
Copy link
Collaborator

@xoscar xoscar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @jorgeepc!

) => {
const baseUrl = Env.get('baseApiUrl');

return fetchBaseQuery({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking ahead a little bit, could we use something like this to inject the tokens or other things coming from the top source?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that is the idea. Use this customBaseQuery to inject tokens, tenantId, etc.

}),
}),
});

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach, if we want it to be even more flexible we could have it be a function which receives an API instance to inject the endpoints to, but this is not needed atm

Base automatically changed from feat/prepare-routing to main July 28, 2023 15:35
@jorgeepc jorgeepc merged commit e8497d9 into main Jul 28, 2023
30 checks passed
@jorgeepc jorgeepc deleted the feat/prepare-api-base-url branch July 28, 2023 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants