useMutation with different URL #1235
-
Having issues trying to pass a different endpoint to a useMutation. We have created a client which has our base URL - this is used for 99% of our queries and mutations on the platform:
I have the scenario now, that I have to send some mutations to a different URL:
Going by the documentation, https://formidable.com/open-source/urql/docs/api/urql/#usemutation - it states that I can pass a OperationContext to this which would allow me to pass a URL. I have not been able to get this working, not sure if its an issue or my implementation.
Everytime I click the above button, it still uses the base path ignores the "additional" values I pass to the
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is referring to arguments, so the first argument, as per this are That being said, I'm generally curious why you're altering the mutation's URL per mutation here. But either way, the above will work just fine 👍 |
Beta Was this translation helpful? Give feedback.
This is referring to arguments, so the first argument, as per this are
variables
the second is a partialcontext
, so by that you'll have to passexecuteMutation(vars, { context: url })
That being said, I'm generally curious why you're altering the mutation's URL per mutation here. But either way, the above will work just fine 👍