Best approach for handling per-request axios config in SWR mutations #1835
Unanswered
takeshiemoto
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking for advice on the best way to handle per-request axios configurations with orval-generated SWR mutations.
Current Behavior
The current orval-generated SWR mutation only allows setting global axios request config when initializing the hook. For example with the following mutator:
Request configs like
onUploadProgress
can only be set globally:Expected Behavior
We should be able to pass different axios configs for each trigger call, utilizing the second parameter of the mutator function:
Current Workaround
Currently using transformer to modify the generated fetcher code, but this is not ideal.
Is there a better way to handle this with the current orval implementation? What would be the recommended approach for supporting per-request configurations in SWR mutations?
Beta Was this translation helpful? Give feedback.
All reactions