-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
How can I specify the server hostname on the fly for the generated requests? #94
Comments
Modifying the OpenAPI config sounds precisely like what you need. Changing the Import the constant into your runtime and modify it with your env url before setting up the react app. /** main.tsx */
import { OpenAPI as OpenAPIConfig } from './openapi/requests/core/OpenAPI';
...
OpenAPIConfig.BASE = 'www.domain.com/api';
...
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<App />
</QueryClientProvider>
</React.StrictMode>
); |
Thanks @seriouslag I have a question regarding this approach. It happens before creating the |
What do you mean by having a list of endpoints? |
Indeed, I can have a multiple set of machines running a server and querying each of them is one of my use cases |
Currently, there is no way to handle a per-request configuration. I opened an issue in the underlying service generator we use to add this feature. Adding your use case there would be helpful to move this feature request along: hey-api/openapi-ts#465 |
Hello,
I'm looking to use
react-query
and the code gen for a project. I'd like to be able to specify on the fly in my React component the host that would receive the query. In my use case I have several machines that could potentially receive the queries I want to send.This is my request for now:
And the generated
SecurityService
class:}
How can I put in ther the hostname and the port ?
Thanks.
The text was updated successfully, but these errors were encountered: