-
I am wondering if there is any way to access the entire url inside an endpoint? I have a custom updateData: build.mutation<any, ArgType>({
query: ({ name, body }) => {
// Looking for getting this information below in a smart way
// A way to extract the base url from baseQuery and concatenate it and the below url field?
const fullUrl = 'http://my-sample-server/api/data/meta/test-name'
const neededInfo = myUtilFunc(fullUrl),
return {
url: `data/meta/${name}`,
method: 'PUT',
body,
headers: { 'If-Match': neededInfo }
};
},
}), |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
That's unfortunately impossible since This could be more possible in |
Beta Was this translation helpful? Give feedback.
That's unfortunately impossible since
baseUrl
is an implementation detail offetchBaseQuery
, so it's not available outside of that.This could be more possible in
prepareHeaders
, but I think you won't be able to access the url there as well. If not that, you'd have to provide your ownfetchFn
, I'm sorry.